Struct base64_simd::OutBuf

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

A write-only slice of T.

Implementations§

source§

impl<'a, T> OutBuf<'a, T>

source

pub unsafe fn from_raw(data: *mut T, len: usize) -> OutBuf<'a, T>

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.

source

pub fn new(slice: &'a mut [T]) -> OutBuf<'a, T>

Forms an OutBuf from an initialized slice.

source

pub fn uninit(slice: &'a mut [MaybeUninit<T>]) -> OutBuf<'a, T>

Forms an OutBuf from an uninitialized slice.

source

pub const fn is_empty(&self) -> bool

Returns true if the buffer has a length of 0.

source

pub const fn len(&self) -> usize

Returns the number of elements in the buffer.

source

pub fn as_mut_ptr(&mut self) -> *mut T

Returns an unsafe mutable pointer to the buffer.

Trait Implementations§

source§

impl<T> Send for OutBuf<'_, T>where T: Send,

source§

impl<T> Sync for OutBuf<'_, T>where T: Sync,

Auto Trait Implementations§

§

impl<'a, T> RefUnwindSafe for OutBuf<'a, T>where T: RefUnwindSafe,

§

impl<'a, T> Unpin for OutBuf<'a, T>

§

impl<'a, T> !UnwindSafe for OutBuf<'a, T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.