MCPcopy Create free account
hub / github.com/PerroEngine/Perro / poll_event

Method poll_event

perro_source/api_modules/perro_networking/src/tcp.rs:148–157  ·  view source on GitHub ↗
(&mut self, max_bytes: usize)

Source from the content-addressed store, hash-verified

146 peer: self.peer_string(),
147 }
148 }
149
150 pub fn read_available(&mut self, max_bytes: usize) -> NetResult<Option<Vec<u8>>> {
151 let mut buf = vec![0_u8; max_bytes.max(1)];
152 match self.stream.read(&mut buf) {
153 Ok(n) => {
154 buf.truncate(n);
155 Ok(Some(buf))
156 }
157 Err(err) if err.kind() == io::ErrorKind::WouldBlock => Ok(None),
158 Err(err) => Err(NetError::from_io(NetErrorKind::Receive, err)),
159 }
160 }

Callers

nothing calls this directly

Calls 3

read_availableMethod · 0.80
peer_stringMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected