#[non_exhaustive]pub enum LengthWidth {
U8,
U16,
U32,
}Expand description
Width of the length prefix, in bytes.
Marked #[non_exhaustive] so wider prefix widths can be added in future
minor releases without a major version bump.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
U8
One-byte length prefix; payload up to 255 bytes.
U16
Two-byte length prefix; payload up to 65 535 bytes.
U32
Four-byte length prefix; payload up to 4 294 967 295 bytes.
Implementations§
Source§impl LengthWidth
impl LengthWidth
Sourcepub const fn header_size(self) -> usize
pub const fn header_size(self) -> usize
Width of the prefix in bytes.
Sourcepub const fn max_payload(self) -> u64
pub const fn max_payload(self) -> u64
Largest payload size encodable by this width.
Trait Implementations§
Source§impl Clone for LengthWidth
impl Clone for LengthWidth
Source§fn clone(&self) -> LengthWidth
fn clone(&self) -> LengthWidth
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LengthWidth
impl Debug for LengthWidth
Source§impl Hash for LengthWidth
impl Hash for LengthWidth
Source§impl PartialEq for LengthWidth
impl PartialEq for LengthWidth
Source§fn eq(&self, other: &LengthWidth) -> bool
fn eq(&self, other: &LengthWidth) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for LengthWidth
impl Eq for LengthWidth
impl StructuralPartialEq for LengthWidth
Auto Trait Implementations§
impl Freeze for LengthWidth
impl RefUnwindSafe for LengthWidth
impl Send for LengthWidth
impl Sync for LengthWidth
impl Unpin for LengthWidth
impl UnsafeUnpin for LengthWidth
impl UnwindSafe for LengthWidth
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