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

pub struct RunDropFields<'a, T> where
    T: DropFields
{ /* fields omitted */ }

A guard that calls DropFields::drop_fields on the mutable reference when it is dropped.

Implementations

impl<'a, T> RunDropFields<'a, T> where
    T: DropFields
[src]

pub unsafe fn new(mutref: &'a mut T, moved: MovedOutFields) -> Self[src]

Constructs this RunDropFields.

Safety

This has the same safety requirements as DropFields::drop_fields.

Drop order

Remember that variables on the stack are dropped in the opposite order than they are declared.

In this example:

This example is not tested
let a=Foo;
let b=Bar;
let c=Baz;

c gets dropped first,then b, then a.

pub unsafe fn get_mut(&mut self) -> &mut T[src]

Reborrows the wrapped mutable reference.

Safety

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

impl<'a, T> RunDropFields<'a, T> where
    T: DropFields
[src]

pub unsafe fn get_mut_and_moved_fields(
    &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.

Trait Implementations

impl<'a, T> Drop for RunDropFields<'a, T> where
    T: DropFields
[src]

Auto Trait Implementations

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

impl<'a, T> Send for RunDropFields<'a, T> where
    T: Send

impl<'a, T> Sync for RunDropFields<'a, T> where
    T: Sync

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

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

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