pub fn read(&self, bytes: &mut [u8]) -> Result<usize, zx_status::Status> {
            with_handle(self.0, |obj| match obj {
                FidlHandle::LeftStreamSocket(cs, _) => match *cs.lock() {
                    StreamSocketState { open, left: ref mut st, .. } => {
                        Self::dequeue_stream_read(open, st, bytes)
                    }
                },
                FidlHandle::RightStreamSocket(cs, _) => match *cs.lock() {
                    StreamSocketState { open, right: ref mut st, .. } => {
                        Self::dequeue_stream_read(open, st, bytes)
                    }
                },
                FidlHandle::LeftDatagramSocket(cs, _) => match *cs.lock() {
                    DatagramSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    DatagramSocketState { left: ref mut st, .. } => {
                        Self::dequeue_datagram_read(st, bytes)
                    }
                },
                FidlHandle::RightDatagramSocket(cs, _) => match *cs.lock() {
                    DatagramSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    DatagramSocketState { right: ref mut st, .. } => {
                        Self::dequeue_datagram_read(st, bytes)
                    }
                },
                _ => panic!("Non socket passed to Socket::read"),
            })
        }
/// Read bytes from the socket.
/// Return value (on success) is number of bytes actually read.
Read bytes from the socket.
Return value (on success) is number of bytes actually read.
Read bytes from the socket . Return value ( on success ) is number of bytes actually read .
pub fn read(&self, bytes: &mut [u8]) -> Result<usize, zx_status::Status> {
            with_handle(self.0, |obj| match obj {
                FidlHandle::LeftStreamSocket(cs, _) => match *cs.lock() {
                    StreamSocketState { open, left: ref mut st, .. } => {
                        Self::dequeue_stream_read(open, st, bytes)
                    }
                },
                FidlHandle::RightStreamSocket(cs, _) => match *cs.lock() {
                    StreamSocketState { open, right: ref mut st, .. } => {
                        Self::dequeue_stream_read(open, st, bytes)
                    }
                },
                FidlHandle::LeftDatagramSocket(cs, _) => match *cs.lock() {
                    DatagramSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    DatagramSocketState { left: ref mut st, .. } => {
                        Self::dequeue_datagram_read(st, bytes)
                    }
                },
                FidlHandle::RightDatagramSocket(cs, _) => match *cs.lock() {
                    DatagramSocketState { open: false, .. } => Err(zx_status::Status::PEER_CLOSED),
                    DatagramSocketState { right: ref mut st, .. } => {
                        Self::dequeue_datagram_read(st, bytes)
                    }
                },
                _ => panic!("Non socket passed to Socket::read"),
            })
        }
pub fn read ( & self , bytes : & mut [ u8 ] ) -> Result < usize , zx_status :: Status > { with_handle ( self . 0 , | obj | match obj { FidlHandle :: LeftStreamSocket ( cs , _ ) => match * cs . lock ( ) { StreamSocketState { open , left : ref mut st , .. } => { Self :: dequeue_stream_read ( open , st , bytes ) } } , FidlHandle :: RightStreamSocket ( cs , _ ) => match * cs . lock ( ) { StreamSocketState { open , right : ref mut st , .. } => { Self :: dequeue_stream_read ( open , st , bytes ) } } , FidlHandle :: LeftDatagramSocket ( cs , _ ) => match * cs . lock ( ) { DatagramSocketState { open : false , .. } => Err ( zx_status :: Status :: PEER_CLOSED ) , DatagramSocketState { left : ref mut st , .. } => { Self :: dequeue_datagram_read ( st , bytes ) } } , FidlHandle :: RightDatagramSocket ( cs , _ ) => match * cs . lock ( ) { DatagramSocketState { open : false , .. } => Err ( zx_status :: Status :: PEER_CLOSED ) , DatagramSocketState { right : ref mut st , .. } => { Self :: dequeue_datagram_read ( st , bytes ) } } , _ => panic ! ( " " ) , } ) }
Read bytes from the socket.
Read bytes from the socket .
&self
bytes
&mut [u8]
&self
bytes
&mut [u8]