pub struct Initializer(/* private fields */);Expand description
A type used to conditionally initialize buffers passed to AsyncRead
methods, modeled after std.
Implementations§
Source§impl Initializer
impl Initializer
Sourcepub fn zeroing() -> Initializer
pub fn zeroing() -> Initializer
Returns a new Initializer which will zero out buffers.
Sourcepub unsafe fn nop() -> Initializer
pub unsafe fn nop() -> Initializer
Returns a new Initializer which will not zero out buffers.
§Safety
This method may only be called by AsyncReaders which guarantee
that they will not read from the buffers passed to AsyncRead
methods, and that the return value of the method accurately reflects
the number of bytes that have been written to the head of the buffer.
Sourcepub fn should_initialize(&self) -> bool
pub fn should_initialize(&self) -> bool
Indicates if a buffer should be initialized.
Sourcepub fn initialize(&self, buf: &mut [u8])
pub fn initialize(&self, buf: &mut [u8])
Initializes a buffer if necessary.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Initializer
impl RefUnwindSafe for Initializer
impl Send for Initializer
impl Sync for Initializer
impl Unpin for Initializer
impl UnwindSafe for Initializer
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> 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> ⓘ
Converts
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> ⓘ
Converts
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