Struct rental::examples::SimpleRefDeref[][src]

pub struct SimpleRefDeref { /* fields omitted */ }

Identical to SimpleRef, but with the deref_suffix flag enabled. This will provide a Deref impl for the struct, which will in turn deref the suffix. Notice that this flag also removes the self param from all methods, replacing it with an explicit param. This prevents any rental methods from blocking deref.

Methods

impl SimpleRefDeref
[src]

Create a new instance of the rental struct.

The first argument provided is the head, followed by a series of closures, one for each tail field. Each of these closures will receive, as its arguments, a borrow of the previous field, followed by borrows of the remaining prefix fields if the struct is a shared rental. If the struct is a mutable rental, only the immediately preceding field is passed.

Attempt to create a new instance of the rental struct.

As new, but each closure returns a Result. If one of them fails, execution is short-circuited and a tuple of the error and the original head value is returned to you.

Attempt to create a new instance of the rental struct.

As try_new, but only the error value is returned upon failure; the head value is dropped. This method interacts more smoothly with existing error conversions.

Return lifetime-erased shared borrows of the fields of the struct.

This is unsafe because the erased lifetimes are fake. Use this only if absolutely necessary and be very mindful of what the true lifetimes are.

Return a lifetime-erased mutable borrow of the suffix of the struct.

This is unsafe because the erased lifetimes are fake. Use this only if absolutely necessary and be very mindful of what the true lifetimes are.

Execute a closure on the shared suffix of the struct.

The closure may return any value not bounded by one of the special rentail lifetimes of the struct.

Execute a closure on the mutable suffix of the struct.

The closure may return any value not bounded by one of the special rentail lifetimes of the struct.

Important traits for &'a mut R

Return a shared reference from the shared suffix of the struct.

This is a subtle variation of rent where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Optionally return a shared reference from the shared suffix of the struct.

This is a subtle variation of rent where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Try to return a shared reference from the shared suffix of the struct, or an error on failure.

This is a subtle variation of rent where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Important traits for &'a mut R

Return a mutable reference from the mutable suffix of the struct.

This is a subtle variation of rent_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Optionally return a mutable reference from the mutable suffix of the struct.

This is a subtle variation of rent_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Try to return a mutable reference from the mutable suffix of the struct, or an error on failure.

This is a subtle variation of rent_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Important traits for Box<R>

Drop the rental struct and return the original head value to you.

impl SimpleRefDeref
[src]

Important traits for Box<R>

Return a shared reference to the head field of the struct.

Execute a closure on shared borrows of the fields of the struct.

The closure may return any value not bounded by one of the special rentail lifetimes of the struct.

Important traits for &'a mut R

Return a shared reference from shared borrows of the fields of the struct.

This is a subtle variation of rent_all where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Optionally return a shared reference from shared borrows of the fields of the struct.

This is a subtle variation of rent_all where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Try to return a shared reference from shared borrows of the fields of the struct, or an error on failure.

This is a subtle variation of rent_all where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Execute a closure on shared borrows of the prefix fields and a mutable borrow of the suffix field of the struct.

The closure may return any value not bounded by one of the special rentail lifetimes of the struct.

Important traits for &'a mut R

Return a mutable reference from shared borrows of the prefix fields and a mutable borrow of the suffix field of the struct.

This is a subtle variation of rent_all_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Optionally return a mutable reference from shared borrows of the prefix fields and a mutable borrow of the suffix field of the struct.

This is a subtle variation of rent_all_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Try to return a mutable reference from shared borrows of the prefix fields and a mutable borrow of the suffix field of the struct, or an error on failure.

This is a subtle variation of rent_all_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.

Methods from Deref<Target = <&'static i32 as Deref>::Target>

Trait Implementations

impl Deref for SimpleRefDeref
[src]

The resulting type after dereferencing.

Dereferences the value.

impl AsRef<Self::Target> for SimpleRefDeref
[src]

Performs the conversion.

Auto Trait Implementations