pub struct OutBuf<'a, T> { /* private fields */ }
Expand description

A write-only slice of T.

Implementations

Forms an OutBuf<'a, T>

Safety

Behavior is undefined if any of the following conditions are violated:

  • data must be valid for writes for len * mem::size_of::<T>() many bytes, and it must be properly aligned. This means in particular:

    • The entire memory range of this slice must be contained within a single allocated object! Slices can never span across multiple allocated objects.
    • data must be non-null and aligned even for zero-length slices. One reason for this is that enum layout optimizations may rely on references (including slices of any length) being aligned and non-null to distinguish them from other data. You can obtain a pointer that is usable as data for zero-length slices using NonNull::dangling().
  • data must point to len consecutive places for type T.

  • The memory referenced by the returned slice must not be accessed through any other pointer (not derived from the return value) for the duration of lifetime 'a. Both read and write accesses are forbidden.

  • The total size len * mem::size_of::<T>() of the slice must be no larger than isize::MAX. See the safety documentation of pointer::offset.

Forms an OutBuf from an initialized slice.

Forms an OutBuf from an uninitialized slice.

Returns true if the buffer has a length of 0.

Returns the number of elements in the buffer.

Returns an unsafe mutable pointer to the buffer.

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.