#[non_exhaustive]pub struct SizeHint { /* private fields */ }
Expand description
A length hint.
Implementations§
Source§impl SizeHint
impl SizeHint
Sourcepub const fn any() -> Self
pub const fn any() -> Self
Construct a size hint of unknown size.
§Examples
use musli::de::SizeHint;
let hint = SizeHint::any();
assert_eq!(hint.or_default(), 0);
Sourcepub const fn exact(length: usize) -> Self
pub const fn exact(length: usize) -> Self
Construct an exactly sized hint.
§Examples
use musli::de::SizeHint;
let hint = SizeHint::exact(16);
assert_eq!(hint.or_default(), 16);
Sourcepub fn or_default(self) -> usize
pub fn or_default(self) -> usize
Get a size hint or a default value.
§Examples
use musli::de::SizeHint;
let hint = SizeHint::any();
assert_eq!(hint.or_default(), 0);
Trait Implementations§
impl Copy for SizeHint
Auto Trait Implementations§
impl Freeze for SizeHint
impl RefUnwindSafe for SizeHint
impl Send for SizeHint
impl Sync for SizeHint
impl Unpin for SizeHint
impl UnwindSafe for SizeHint
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
)