pub struct KcpSegmentMut<'a> { /* private fields */ }Expand description
An exact mutable KCP segment with a structurally complete declared payload.
Implementations§
Source§impl<'a> KcpSegmentMut<'a>
impl<'a> KcpSegmentMut<'a>
Sourcepub fn parse(
bytes: &'a mut [u8],
) -> Result<(Self, &'a mut [u8]), KcpSegmentParseError>
pub fn parse( bytes: &'a mut [u8], ) -> Result<(Self, &'a mut [u8]), KcpSegmentParseError>
Parses exactly one KCP segment and returns the unconsumed mutable input suffix.
This validates only structural boundaries. Raw command bytes and all field values are preserved without runtime KCP semantic validation.
Sourcepub fn conversation_id(&self) -> KcpConversationId
pub fn conversation_id(&self) -> KcpConversationId
Returns the conversation identifier.
Sourcepub fn command(&self) -> KcpCommand
pub fn command(&self) -> KcpCommand
Returns the raw command byte.
Sourcepub fn fragment(&self) -> KcpFragment
pub fn fragment(&self) -> KcpFragment
Returns the fragment number.
Sourcepub fn window_size(&self) -> u16
pub fn window_size(&self) -> u16
Returns the advertised receive window.
Sourcepub fn timestamp(&self) -> KcpTimestamp
pub fn timestamp(&self) -> KcpTimestamp
Returns the timestamp.
Sourcepub fn sequence_number(&self) -> KcpSequenceNumber
pub fn sequence_number(&self) -> KcpSequenceNumber
Returns the sequence number.
Sourcepub fn unacknowledged(&self) -> KcpUnacknowledged
pub fn unacknowledged(&self) -> KcpUnacknowledged
Returns the unacknowledged sequence-number marker.
Sourcepub fn payload_length(&self) -> u32
pub fn payload_length(&self) -> u32
Returns the encoded payload length.
Sourcepub fn payload_mut(&mut self) -> &mut [u8] ⓘ
pub fn payload_mut(&mut self) -> &mut [u8] ⓘ
Returns the exact payload bytes mutably without changing its encoded length.
Sourcepub fn as_bytes(&self) -> &[u8]
pub fn as_bytes(&self) -> &[u8]
Returns the exact complete segment bytes, excluding any input suffix.
Sourcepub fn set_conversation_id(&mut self, value: KcpConversationId)
pub fn set_conversation_id(&mut self, value: KcpConversationId)
Replaces the conversation identifier.
Sourcepub fn set_command(&mut self, value: KcpCommand)
pub fn set_command(&mut self, value: KcpCommand)
Replaces the raw command byte.
Sourcepub fn set_fragment(&mut self, value: KcpFragment)
pub fn set_fragment(&mut self, value: KcpFragment)
Replaces the fragment number.
Sourcepub fn set_window_size(&mut self, value: u16)
pub fn set_window_size(&mut self, value: u16)
Replaces the advertised receive window.
Sourcepub fn set_timestamp(&mut self, value: KcpTimestamp)
pub fn set_timestamp(&mut self, value: KcpTimestamp)
Replaces the timestamp.
Sourcepub fn set_sequence_number(&mut self, value: KcpSequenceNumber)
pub fn set_sequence_number(&mut self, value: KcpSequenceNumber)
Replaces the sequence number.
Sourcepub fn set_unacknowledged(&mut self, value: KcpUnacknowledged)
pub fn set_unacknowledged(&mut self, value: KcpUnacknowledged)
Replaces the unacknowledged sequence-number marker.