pub fn write(&self, bytes: &[u8]) -> Result<usize, zx_status::Status> {
            let (result, wakeup) = with_handle(self.0, |obj| match obj {
                FidlHandle::LeftStreamSocket(cs, peer) => match *cs.lock() {
                    StreamSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    StreamSocketState { right: ref mut st, .. } => {
                        Self::enqueue_stream_write(st, *peer, bytes)
                    }
                },
                FidlHandle::RightStreamSocket(cs, peer) => match *cs.lock() {
                    StreamSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    StreamSocketState { left: ref mut st, .. } => {
                        Self::enqueue_stream_write(st, *peer, bytes)
                    }
                },
                FidlHandle::LeftDatagramSocket(cs, peer) => match *cs.lock() {
                    DatagramSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    DatagramSocketState { right: ref mut st, .. } => {
                        Self::enqueue_datagram_write(st, *peer, bytes)
                    }
                },
                FidlHandle::RightDatagramSocket(cs, peer) => match *cs.lock() {
                    DatagramSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    DatagramSocketState { left: ref mut st, .. } => {
                        Self::enqueue_datagram_write(st, *peer, bytes)
                    }
                },
                _ => panic!("Non socket passed to Socket::write"),
            })?;
            if wakeup != INVALID_HANDLE {
                hdl_awaken(wakeup);
            }
            Ok(result)
        }
/// Write the given bytes into the socket.
/// Return value (on success) is number of bytes actually written.
Write the given bytes into the socket.
Return value (on success) is number of bytes actually written.
Write the given bytes into the socket . Return value ( on success ) is number of bytes actually written .
pub fn write(&self, bytes: &[u8]) -> Result<usize, zx_status::Status> {
            let (result, wakeup) = with_handle(self.0, |obj| match obj {
                FidlHandle::LeftStreamSocket(cs, peer) => match *cs.lock() {
                    StreamSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    StreamSocketState { right: ref mut st, .. } => {
                        Self::enqueue_stream_write(st, *peer, bytes)
                    }
                },
                FidlHandle::RightStreamSocket(cs, peer) => match *cs.lock() {
                    StreamSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    StreamSocketState { left: ref mut st, .. } => {
                        Self::enqueue_stream_write(st, *peer, bytes)
                    }
                },
                FidlHandle::LeftDatagramSocket(cs, peer) => match *cs.lock() {
                    DatagramSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    DatagramSocketState { right: ref mut st, .. } => {
                        Self::enqueue_datagram_write(st, *peer, bytes)
                    }
                },
                FidlHandle::RightDatagramSocket(cs, peer) => match *cs.lock() {
                    DatagramSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    DatagramSocketState { left: ref mut st, .. } => {
                        Self::enqueue_datagram_write(st, *peer, bytes)
                    }
                },
                _ => panic!("Non socket passed to Socket::write"),
            })?;
            if wakeup != INVALID_HANDLE {
                hdl_awaken(wakeup);
            }
            Ok(result)
        }
pub fn write ( & self , bytes : & [ u8 ] ) -> Result < usize , zx_status :: Status > { let ( result , wakeup ) = with_handle ( self . 0 , | obj | match obj { FidlHandle :: LeftStreamSocket ( cs , peer ) => match * cs . lock ( ) { StreamSocketState { open : false , .. } => Err ( zx_status :: Status :: PEER_CLOSED ) , StreamSocketState { right : ref mut st , .. } => { Self :: enqueue_stream_write ( st , * peer , bytes ) } } , FidlHandle :: RightStreamSocket ( cs , peer ) => match * cs . lock ( ) { StreamSocketState { open : false , .. } => Err ( zx_status :: Status :: PEER_CLOSED ) , StreamSocketState { left : ref mut st , .. } => { Self :: enqueue_stream_write ( st , * peer , bytes ) } } , FidlHandle :: LeftDatagramSocket ( cs , peer ) => match * cs . lock ( ) { DatagramSocketState { open : false , .. } => Err ( zx_status :: Status :: PEER_CLOSED ) , DatagramSocketState { right : ref mut st , .. } => { Self :: enqueue_datagram_write ( st , * peer , bytes ) } } , FidlHandle :: RightDatagramSocket ( cs , peer ) => match * cs . lock ( ) { DatagramSocketState { open : false , .. } => Err ( zx_status :: Status :: PEER_CLOSED ) , DatagramSocketState { left : ref mut st , .. } => { Self :: enqueue_datagram_write ( st , * peer , bytes ) } } , _ => panic ! ( " " ) , } ) ? ; if wakeup != INVALID_HANDLE { hdl_awaken ( wakeup ) ; } Ok ( result ) }
Write the given bytes into the socket.
Write the given bytes into the socket .
&self
bytes
&[u8]
&self
bytes
&[u8]