pub struct KcpSegment<'a> { /* private fields */ }Expand description
An exact borrowed KCP segment with a structurally complete declared payload.
Implementations§
Source§impl<'a> KcpSegment<'a>
impl<'a> KcpSegment<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), KcpSegmentParseError>
pub fn parse(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), KcpSegmentParseError>
Parses exactly one KCP segment and returns the unconsumed input suffix.
This validates only structural boundaries. Raw command bytes and all field values are preserved without runtime KCP semantic validation.
Sourcepub const fn conversation_id(self) -> KcpConversationId
pub const fn conversation_id(self) -> KcpConversationId
Returns the conversation identifier.
Sourcepub const fn command(self) -> KcpCommand
pub const fn command(self) -> KcpCommand
Returns the raw command byte.
Sourcepub const fn fragment(self) -> KcpFragment
pub const fn fragment(self) -> KcpFragment
Returns the fragment number.
Sourcepub const fn window_size(self) -> u16
pub const fn window_size(self) -> u16
Returns the advertised receive window.
Sourcepub const fn timestamp(self) -> KcpTimestamp
pub const fn timestamp(self) -> KcpTimestamp
Returns the timestamp.
Sourcepub const fn sequence_number(self) -> KcpSequenceNumber
pub const fn sequence_number(self) -> KcpSequenceNumber
Returns the sequence number.
Sourcepub const fn unacknowledged(self) -> KcpUnacknowledged
pub const fn unacknowledged(self) -> KcpUnacknowledged
Returns the unacknowledged sequence-number marker.
Sourcepub const fn payload_length(self) -> u32
pub const fn payload_length(self) -> u32
Returns the encoded payload length.
Trait Implementations§
Source§impl<'a> Clone for KcpSegment<'a>
impl<'a> Clone for KcpSegment<'a>
impl<'a> Copy for KcpSegment<'a>
Source§impl<'a> Debug for KcpSegment<'a>
impl<'a> Debug for KcpSegment<'a>
impl<'a> Eq for KcpSegment<'a>
Source§impl<'a> PartialEq for KcpSegment<'a>
impl<'a> PartialEq for KcpSegment<'a>
impl<'a> StructuralPartialEq for KcpSegment<'a>
Auto Trait Implementations§
impl<'a> Freeze for KcpSegment<'a>
impl<'a> RefUnwindSafe for KcpSegment<'a>
impl<'a> Send for KcpSegment<'a>
impl<'a> Sync for KcpSegment<'a>
impl<'a> Unpin for KcpSegment<'a>
impl<'a> UnsafeUnpin for KcpSegment<'a>
impl<'a> UnwindSafe for KcpSegment<'a>
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