Struct mycelium_util::io::Initializer
source · pub struct Initializer(/* private fields */);
Expand description
A type used to conditionally initialize buffers passed to Read
methods.
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 may only be called by Read
ers which guarantee that they will not
read from buffers passed to Read
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