pub struct Kcp { /* private fields */ }
Implementations§
Source§impl Kcp
impl Kcp
pub fn new(conv: u32) -> Self
pub fn get_system_time(&self) -> u32
Sourcepub fn initialize(&mut self)
pub fn initialize(&mut self)
§Warning
After initialization, self must be pinned in memory.
Sourcepub fn peek(&mut self, buf: &mut [u8]) -> Result<usize>
pub fn peek(&mut self, buf: &mut [u8]) -> Result<usize>
io::ErrorKind::InvalidInput - buffer is too small to contain a frame.
Sourcepub fn recv(&mut self, buf: &mut [u8]) -> Result<usize>
pub fn recv(&mut self, buf: &mut [u8]) -> Result<usize>
io::ErrorKind::InvalidInput - buffer is too small to contain a frame.
pub fn recv_bytes(&mut self) -> Option<Bytes>
pub fn peek_size(&self) -> usize
Sourcepub fn send(&mut self, data: &[u8]) -> Result<usize>
pub fn send(&mut self, data: &[u8]) -> Result<usize>
io::ErrorKind::InvalidInput - frame is too large.
Sourcepub fn input(&mut self, packet: &[u8]) -> Result<()>
pub fn input(&mut self, packet: &[u8]) -> Result<()>
ErrorKind::NotFound - conv is inconsistent
ErrorKind::InvalidData - Invalid packet or unrecognized command
pub fn flush(&mut self)
pub fn update(&mut self, current: u32)
pub fn check(&self, current: u32) -> u32
pub fn set_mtu(&mut self, mtu: u32) -> Result<()>
pub fn set_nodelay( &mut self, nodelay: bool, interval: u32, resend: u32, nc: bool, )
pub fn get_waitsnd(&self) -> u32
pub fn set_wndsize(&mut self, sndwnd: u32, rcvwnd: u32)
Source§impl Kcp
impl Kcp
pub fn conv(&self) -> u32
pub fn current(&self) -> u32
pub fn nsnd_que(&self) -> u32
pub fn nrcv_que(&self) -> u32
pub fn nrcv_buf(&self) -> u32
pub fn duration_since(&self, since: u32) -> u32
pub fn set_logmask(&mut self, logmask: u32)
pub fn set_conv(&mut self, conv: u32)
pub fn set_stream(&mut self, stream: bool)
pub fn is_dead_link(&self) -> bool
pub fn is_recv_queue_full(&self) -> bool
pub fn is_send_queue_full(&self) -> bool
pub fn has_ouput(&mut self) -> bool
pub fn pop_output(&mut self) -> Option<BytesMut>
pub fn write_ack_head( &self, buf: &mut BytesMut, cmd_flags: u8, payload_size: usize, )
Sourcepub fn read_payload_data(buf: &[u8]) -> Option<&[u8]>
pub fn read_payload_data(buf: &[u8]) -> Option<&[u8]>
Get the first segment payload from a packet buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Kcp
impl RefUnwindSafe for Kcp
impl Send for Kcp
impl Sync for Kcp
impl Unpin for Kcp
impl UnwindSafe for Kcp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more