Struct constmuck::ImplsCopy[][src]

pub struct ImplsCopy<T> { /* fields omitted */ }
Expand description

Encodes that a T is trivially copyable, avoiding requiring (unstable as of 2021) trait bounds in const fns.

Related: the copying module

Bound

This currently requires Pod because the approach constmuck has for copying uses an intermediate MaybeUninit<[u8; N]>, which isn’t settled as being sound to use with pointer types, but is guaranteed sound for Pod types.

If there’s a more permissive bound that allows more non-pointer-containing Copy types, ImplsCopy will be changed to use that.

Implementations

Constructs an ImplsCopy

You can also use the infer macro to construct ImplsCopy arguments.

Constructs an ImplsCopy<T> without checking that T implements Copy + Pod.

Safety

You must ensure that T is safe to memcpy without forgetting the copied-from value, and doesn’t contain pointers of any kind.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Constructs this type.

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.