[][src]Struct structural::field::ownership::IntoFieldsWrapper

pub struct IntoFieldsWrapper<T: DropFields> { /* fields omitted */ }

Helper type for moving fields out of a Structural type.

Drop behavior

The wrapped value is put inside a ManuallyDrop so that its destructor doesn't run.

When this is dropped,instead of running the destructor for the wrapped value, this calls DropFields::drop_fields on it, to drop the fields that haven't been moved out.

Example

For an example that uses IntoFieldsWrapper there's the implementation example for RevIntoMultiFieldImpl

Implementations

impl<T: DropFields> IntoFieldsWrapper<T>[src]

pub fn new(value: T) -> Self[src]

Constructs this IntoFieldsWrapper,wrapping the value.

Also calls DropFields::pre_move on the wrapped value

pub unsafe fn inner_and_moved_mut(&mut self) -> (&mut T, &mut MovedOutFields)[src]

Gets mutable references to the wrapped value, and the MovedOutFields that tracks which fields were moved out of it.

Safety

The returned references must not be mutated, only passed to accessor trait (declared in structural) methods for moving out fields .

Mutating MovedOutFields incorrectly can lead to leaks and double dropped fields.

pub unsafe fn inner_and_moved_raw(&mut self) -> (*mut T, *mut MovedOutFields)[src]

Gets mutable pointers to the wrapped value, and the MovedOutFields that tracks which fields were moved out of it.

Safety

The returned pointers must not be mutated, only passed to accessor trait (declared in structural) methods for moving out fields .

Mutating MovedOutFields incorrectly can lead to leaks and double dropped fields.

Trait Implementations

impl<T: DropFields> Drop for IntoFieldsWrapper<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for IntoFieldsWrapper<T> where
    T: RefUnwindSafe

impl<T> Send for IntoFieldsWrapper<T> where
    T: Send

impl<T> Sync for IntoFieldsWrapper<T> where
    T: Sync

impl<T> Unpin for IntoFieldsWrapper<T> where
    T: Unpin

impl<T> UnwindSafe for IntoFieldsWrapper<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<This, T> Array0<T> for This where
    This: ?Sized
[src]

impl<This, V, T> Array0Variant<T, V> for This where
    This: ?Sized
[src]

impl<This, T> ArrayMove0<T> for This where
    This: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<This, T> IntoStructural<T> for This where
    T: FromStructural<This>, 
[src]

impl<T> SelfOps for T where
    T: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The error type returned when the conversion fails.

impl<This, T> TryIntoStructural<T> for This where
    T: TryFromStructural<This>, 
[src]

type Error = <T as TryFromStructural<This>>::Error

The error parameter of TryFromError, returned from try_into_structural on conversion error. Read more

impl<T> TypeIdentity for T where
    T: ?Sized
[src]

type Type = T

The same type as Self. Read more