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 ONE: WindowSize
pub const ONE: WindowSize
A window size of 1, the smallest nonzero 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 saturating_sub(self, diff: usize) -> Self
pub fn saturating_sub(self, diff: usize) -> Self
Subtract diff
from self
returning WindowSize::ZERO
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.
Sourcepub fn halved(self) -> WindowSize
pub fn halved(self) -> WindowSize
Returns this WindowSize
with a halved value
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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Source§impl From<WindowSize> for usize
impl From<WindowSize> for usize
Source§fn from(WindowSize: WindowSize) -> Self
fn from(WindowSize: WindowSize) -> Self
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,
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
>>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more