pub struct WindowSize(/* private fields */);
Expand description
A witness type for TCP window size.
Per RFC 7323 Section 2.3:
…, the above constraints imply that two times the maximum window size must be less than 2^31, or max window < 2^30
Implementations§
Source§impl WindowSize
impl WindowSize
Sourcepub const MAX: WindowSize = _
pub const MAX: WindowSize = _
The largest possible window size.
Sourcepub const ZERO: WindowSize = _
pub const ZERO: WindowSize = _
The smallest possible window size.
Sourcepub const DEFAULT: WindowSize = _
pub const DEFAULT: WindowSize = _
The Netstack3 default window size.
Sourcepub const fn from_u32(wnd: u32) -> Option<Self>
pub const fn from_u32(wnd: u32) -> Option<Self>
Create a new WindowSize
from the provided u32
.
If the provided window size is out of range, then None
is returned.
Sourcepub fn saturating_add(self, rhs: u32) -> Self
pub fn saturating_add(self, rhs: u32) -> Self
Add a u32
to this WindowSize, saturating at WindowSize::MAX
.
Sourcepub fn new(wnd: usize) -> Option<Self>
pub fn new(wnd: usize) -> Option<Self>
Create a new WindowSize
, returning None
if the argument is out of range.
Sourcepub fn checked_sub(self, diff: usize) -> Option<Self>
pub fn checked_sub(self, diff: usize) -> Option<Self>
Subtract diff
from self
, returning None
if the result would be negative.
Sourcepub fn scale(self) -> WindowScale
pub fn scale(self) -> WindowScale
The window scale that needs to be advertised during the handshake.
Trait Implementations§
Source§impl Add<WindowSize> for SeqNum
impl Add<WindowSize> for SeqNum
Source§impl Clone for WindowSize
impl Clone for WindowSize
Source§fn clone(&self) -> WindowSize
fn clone(&self) -> WindowSize
Returns a copy of the value. Read more
1.0.0 · 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 WindowSize
impl Debug for WindowSize
Source§impl From<WindowSize> for u32
impl From<WindowSize> for u32
Source§fn from(WindowSize: WindowSize) -> Self
fn from(WindowSize: WindowSize) -> Self
Converts to this type from the input type.
Source§impl From<WindowSize> for usize
impl From<WindowSize> for usize
Source§fn from(WindowSize: WindowSize) -> Self
fn from(WindowSize: WindowSize) -> Self
Converts to this type from the input type.
Source§impl Ord for WindowSize
impl Ord for WindowSize
Source§fn cmp(&self, other: &WindowSize) -> Ordering
fn cmp(&self, other: &WindowSize) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for WindowSize
impl PartialEq for WindowSize
Source§impl PartialOrd for WindowSize
impl PartialOrd for WindowSize
Source§impl Shr<WindowScale> for WindowSize
impl Shr<WindowScale> for WindowSize
Source§type Output = UnscaledWindowSize
type Output = UnscaledWindowSize
The resulting type after applying the
>>
operator.Source§impl Sub<WindowSize> for SeqNum
impl Sub<WindowSize> for SeqNum
impl Copy for WindowSize
impl Eq for WindowSize
impl StructuralPartialEq for WindowSize
Auto Trait Implementations§
impl Freeze for WindowSize
impl RefUnwindSafe for WindowSize
impl Send for WindowSize
impl Sync for WindowSize
impl Unpin for WindowSize
impl UnwindSafe for WindowSize
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
Source§impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
Source§fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
Send a frame. Read more
Source§impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
Source§fn handle_timer(
&mut self,
bindings_ctx: &mut BC,
dispatch: Id,
timer: <BC as TimerBindingsTypes>::UniqueTimerId,
)
fn handle_timer( &mut self, bindings_ctx: &mut BC, dispatch: Id, timer: <BC as TimerBindingsTypes>::UniqueTimerId, )
Handle a timer firing. Read more