@@ -19,7 +19,7 @@ use super::{sockaddr_un, SocketAddr};
19
19
target_os = "netbsd" ,
20
20
target_os = "openbsd" ,
21
21
) ) ]
22
- use crate :: io:: IoSliceMut ;
22
+ use crate :: io:: { IoSlice , IoSliceMut } ;
23
23
use crate :: net:: Shutdown ;
24
24
use crate :: os:: unix:: io:: { AsRawFd , FromRawFd , IntoRawFd , RawFd } ;
25
25
use crate :: path:: Path ;
@@ -506,23 +506,24 @@ impl UnixDatagram {
506
506
/// ```no_run
507
507
/// #![feature(unix_socket_ancillary_data)]
508
508
/// use std::os::unix::net::{UnixDatagram, SocketAncillary};
509
- /// use std::io::IoSliceMut ;
509
+ /// use std::io::IoSlice ;
510
510
///
511
511
/// fn main() -> std::io::Result<()> {
512
512
/// let sock = UnixDatagram::unbound()?;
513
- /// let mut buf1 = [1; 8];
514
- /// let mut buf2 = [2; 16];
515
- /// let mut buf3 = [3; 8];
516
- /// let mut bufs = &mut [
517
- /// IoSliceMut ::new(&mut buf1),
518
- /// IoSliceMut ::new(&mut buf2),
519
- /// IoSliceMut ::new(&mut buf3),
513
+ /// let buf1 = [1; 8];
514
+ /// let buf2 = [2; 16];
515
+ /// let buf3 = [3; 8];
516
+ /// let bufs = &[
517
+ /// IoSlice ::new(&buf1),
518
+ /// IoSlice ::new(&buf2),
519
+ /// IoSlice ::new(&buf3),
520
520
/// ][..];
521
521
/// let fds = [0, 1, 2];
522
522
/// let mut ancillary_buffer = [0; 128];
523
523
/// let mut ancillary = SocketAncillary::new(&mut ancillary_buffer[..]);
524
524
/// ancillary.add_fds(&fds[..]);
525
- /// sock.send_vectored_with_ancillary_to(bufs, &mut ancillary, "/some/sock").expect("send_vectored_with_ancillary_to function failed");
525
+ /// sock.send_vectored_with_ancillary_to(bufs, &mut ancillary, "/some/sock")
526
+ /// .expect("send_vectored_with_ancillary_to function failed");
526
527
/// Ok(())
527
528
/// }
528
529
/// ```
@@ -538,7 +539,7 @@ impl UnixDatagram {
538
539
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
539
540
pub fn send_vectored_with_ancillary_to < P : AsRef < Path > > (
540
541
& self ,
541
- bufs : & mut [ IoSliceMut < ' _ > ] ,
542
+ bufs : & [ IoSlice < ' _ > ] ,
542
543
ancillary : & mut SocketAncillary < ' _ > ,
543
544
path : P ,
544
545
) -> io:: Result < usize > {
@@ -554,23 +555,24 @@ impl UnixDatagram {
554
555
/// ```no_run
555
556
/// #![feature(unix_socket_ancillary_data)]
556
557
/// use std::os::unix::net::{UnixDatagram, SocketAncillary};
557
- /// use std::io::IoSliceMut ;
558
+ /// use std::io::IoSlice ;
558
559
///
559
560
/// fn main() -> std::io::Result<()> {
560
561
/// let sock = UnixDatagram::unbound()?;
561
- /// let mut buf1 = [1; 8];
562
- /// let mut buf2 = [2; 16];
563
- /// let mut buf3 = [3; 8];
564
- /// let mut bufs = &mut [
565
- /// IoSliceMut ::new(&mut buf1),
566
- /// IoSliceMut ::new(&mut buf2),
567
- /// IoSliceMut ::new(&mut buf3),
562
+ /// let buf1 = [1; 8];
563
+ /// let buf2 = [2; 16];
564
+ /// let buf3 = [3; 8];
565
+ /// let bufs = &[
566
+ /// IoSlice ::new(&buf1),
567
+ /// IoSlice ::new(&buf2),
568
+ /// IoSlice ::new(&buf3),
568
569
/// ][..];
569
570
/// let fds = [0, 1, 2];
570
571
/// let mut ancillary_buffer = [0; 128];
571
572
/// let mut ancillary = SocketAncillary::new(&mut ancillary_buffer[..]);
572
573
/// ancillary.add_fds(&fds[..]);
573
- /// sock.send_vectored_with_ancillary(bufs, &mut ancillary).expect("send_vectored_with_ancillary function failed");
574
+ /// sock.send_vectored_with_ancillary(bufs, &mut ancillary)
575
+ /// .expect("send_vectored_with_ancillary function failed");
574
576
/// Ok(())
575
577
/// }
576
578
/// ```
@@ -586,7 +588,7 @@ impl UnixDatagram {
586
588
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
587
589
pub fn send_vectored_with_ancillary (
588
590
& self ,
589
- bufs : & mut [ IoSliceMut < ' _ > ] ,
591
+ bufs : & [ IoSlice < ' _ > ] ,
590
592
ancillary : & mut SocketAncillary < ' _ > ,
591
593
) -> io:: Result < usize > {
592
594
send_vectored_with_ancillary_to ( & self . 0 , None , bufs, ancillary)
0 commit comments