pub struct BufferCapacity { /* private fields */ }
Expand description
Wrapper type used to define buffer capacity.
Capacity must be greater than 0 and less or equal usize::MAX / 2
.
§Examples
let capacity = BufferCapacity::try_from(16).unwrap();
assert_eq!(16, *capacity.as_ref());
let result = BufferCapacity::try_from(0);
assert!(result.is_err());
let result = BufferCapacity::try_from(usize::MAX / 2 + 1);
assert!(result.is_err());
Trait Implementations§
Source§impl AsRef<usize> for BufferCapacity
impl AsRef<usize> for BufferCapacity
Source§impl Clone for BufferCapacity
impl Clone for BufferCapacity
Source§fn clone(&self) -> BufferCapacity
fn clone(&self) -> BufferCapacity
Returns a duplicate 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 BufferCapacity
impl Debug for BufferCapacity
Source§impl Default for BufferCapacity
Default capacity value is 16.
impl Default for BufferCapacity
Default capacity value is 16.
Source§impl<'de> Deserialize<'de> for BufferCapacity
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for BufferCapacity
Available on crate feature
serde
only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for BufferCapacity
impl Ord for BufferCapacity
Source§fn cmp(&self, other: &BufferCapacity) -> Ordering
fn cmp(&self, other: &BufferCapacity) -> 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 BufferCapacity
impl PartialEq for BufferCapacity
Source§impl PartialOrd for BufferCapacity
impl PartialOrd for BufferCapacity
Source§impl Serialize for BufferCapacity
Available on crate feature serde
only.
impl Serialize for BufferCapacity
Available on crate feature
serde
only.Source§impl TryFrom<usize> for BufferCapacity
impl TryFrom<usize> for BufferCapacity
impl Copy for BufferCapacity
impl Eq for BufferCapacity
impl StructuralPartialEq for BufferCapacity
Auto Trait Implementations§
impl Freeze for BufferCapacity
impl RefUnwindSafe for BufferCapacity
impl Send for BufferCapacity
impl Sync for BufferCapacity
impl Unpin for BufferCapacity
impl UnwindSafe for BufferCapacity
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