Struct write_only::WriteOnlyRef[][src]

pub struct WriteOnlyRef<'a, T: 'a> { /* fields omitted */ }
Expand description

A write-only reference with dropping non-volatile write access.

Implementations

Forms a write-only reference from a pointer.

Safety

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

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

    • data must be non-null and aligned. One reason for this is that enum layout optimizations may rely on references being aligned and non-null to distinguish them from other data.
  • The memory referenced by the returned reference must not be mutated for the duration of lifetime 'a, except inside an UnsafeCell.

Caveat

The lifetime for the returned reference is inferred from its usage. To prevent accidental misuse, it’s suggested to tie the lifetime to whichever source lifetime is safe in the context, such as by providing a helper function taking the lifetime of a host guard for the reference, or by explicit annotation.

Trait Implementations

Performs the conversion.

Puts the value the given value, dropping the old value.

Writes the value the given value without dropping the old value.

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

Performs the conversion.

Performs the conversion.

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.