pub enum SessionMessage<const C: usize> {
Segment(Segment),
Request(SegmentRequest<C>),
Acknowledge(FrameAcknowledgements<C>),
}
Expand description
Contains all messages of the Session sub-protocol.
The maximum size of the Session sub-protocol message is given by C
.
Variants§
Segment(Segment)
Represents a message containing a segment.
Request(SegmentRequest<C>)
Represents a message containing a request for segments.
Acknowledge(FrameAcknowledgements<C>)
Represents a message containing frame acknowledgements.
Implementations§
Source§impl<const C: usize> SessionMessage<C>
impl<const C: usize> SessionMessage<C>
pub fn try_as_segment(self) -> Option<Segment>
pub const fn try_as_segment_ref(&self) -> Option<&Segment>
pub fn try_as_segment_mut(&mut self) -> Option<&mut Segment>
pub fn try_as_request(self) -> Option<SegmentRequest<C>>
pub const fn try_as_request_ref(&self) -> Option<&SegmentRequest<C>>
pub fn try_as_request_mut(&mut self) -> Option<&mut SegmentRequest<C>>
pub fn try_as_acknowledge(self) -> Option<FrameAcknowledgements<C>>
pub const fn try_as_acknowledge_ref(&self) -> Option<&FrameAcknowledgements<C>>
pub fn try_as_acknowledge_mut( &mut self, ) -> Option<&mut FrameAcknowledgements<C>>
Source§impl<const C: usize> SessionMessage<C>
impl<const C: usize> SessionMessage<C>
Sourcepub const HEADER_SIZE: usize = 4usize
pub const HEADER_SIZE: usize = 4usize
Header size of the session message. This is currently the version byte, the size of SessionMessageDiscriminants representation and two bytes for the message length.
Sourcepub const SEGMENT_OVERHEAD: usize = 10usize
pub const SEGMENT_OVERHEAD: usize = 10usize
Size of the overhead that’s added to the raw payload of each Segment
.
This amounts to SessionMessage::HEADER_SIZE
+ Segment::HEADER_SIZE
.
Sourcepub const MAX_MESSAGE_SIZE: usize = 1_482usize
pub const MAX_MESSAGE_SIZE: usize = 1_482usize
Maximum size of the Session protocol message.
This is equal to the typical Ethernet MTU size minus Self::SEGMENT_OVERHEAD
.
Sourcepub const MAX_SEGMENTS_PER_FRAME: usize = 8usize
pub const MAX_SEGMENTS_PER_FRAME: usize = 8usize
Maximum number of segments per frame.
Sourcepub fn minimum_message_size() -> usize
pub fn minimum_message_size() -> usize
Returns the minimum size of a SessionMessage.
Sourcepub fn into_encoded(self) -> Box<[u8]>
pub fn into_encoded(self) -> Box<[u8]>
Convenience method to encode the session message.
Trait Implementations§
Source§impl<const C: usize> Clone for SessionMessage<C>
impl<const C: usize> Clone for SessionMessage<C>
Source§fn clone(&self) -> SessionMessage<C>
fn clone(&self) -> SessionMessage<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<const C: usize> Debug for SessionMessage<C>
impl<const C: usize> Debug for SessionMessage<C>
Source§impl<const C: usize> Display for SessionMessage<C>
impl<const C: usize> Display for SessionMessage<C>
Source§impl<'_enum, const C: usize> From<&'_enum SessionMessage<C>> for SessionMessageDiscriminants
impl<'_enum, const C: usize> From<&'_enum SessionMessage<C>> for SessionMessageDiscriminants
Source§fn from(val: &'_enum SessionMessage<C>) -> SessionMessageDiscriminants
fn from(val: &'_enum SessionMessage<C>) -> SessionMessageDiscriminants
Source§impl<const C: usize> From<SessionMessage<C>> for SessionMessageDiscriminants
impl<const C: usize> From<SessionMessage<C>> for SessionMessageDiscriminants
Source§fn from(val: SessionMessage<C>) -> SessionMessageDiscriminants
fn from(val: SessionMessage<C>) -> SessionMessageDiscriminants
Source§impl<const C: usize> From<SessionMessage<C>> for Vec<u8>
impl<const C: usize> From<SessionMessage<C>> for Vec<u8>
Source§fn from(value: SessionMessage<C>) -> Self
fn from(value: SessionMessage<C>) -> Self
Source§impl<const C: usize> PartialEq for SessionMessage<C>
impl<const C: usize> PartialEq for SessionMessage<C>
Source§impl<const C: usize> Sink<SessionMessage<C>> for SessionState<C>
impl<const C: usize> Sink<SessionMessage<C>> for SessionState<C>
Source§type Error = NetworkTypeError
type Error = NetworkTypeError
Source§fn poll_ready(
self: Pin<&mut Self>,
_: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, _: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Sink
to receive a value. Read moreSource§fn start_send(
self: Pin<&mut Self>,
item: SessionMessage<C>,
) -> Result<(), Self::Error>
fn start_send( self: Pin<&mut Self>, item: SessionMessage<C>, ) -> Result<(), Self::Error>
poll_ready
which returned Poll::Ready(Ok(()))
. Read moreimpl<const C: usize> Eq for SessionMessage<C>
impl<const C: usize> StructuralPartialEq for SessionMessage<C>
Auto Trait Implementations§
impl<const C: usize> Freeze for SessionMessage<C>
impl<const C: usize> RefUnwindSafe for SessionMessage<C>
impl<const C: usize> Send for SessionMessage<C>
impl<const C: usize> Sync for SessionMessage<C>
impl<const C: usize> Unpin for SessionMessage<C>
impl<const C: usize> UnwindSafe for SessionMessage<C>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.