Module rental::examples[][src]

Example types that demonstrate the API generated by the rental macro.

Structs

SimpleMut

The simplest mutable rental. Mutable rentals have a slightly different API; compare this struct to SimpleRef for the clearest picture of how they differ.

SimpleMutDeref

Identical to SimpleMut, but with the deref_mut_suffix flag enabled. This will provide a DerefMut 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.

SimpleMutDeref_Borrow

Shared borrow of a rental struct.

SimpleMutDeref_BorrowMut

Mutable borrow of a rental struct.

SimpleMut_Borrow

Shared borrow of a rental struct.

SimpleMut_BorrowMut

Mutable borrow of a rental struct.

SimpleRef

The simplest shared rental. The head is a boxed integer, and the suffix is a ref to that integer. This struct demonstrates the basic API that all shared rental structs have. See SimpleMut for the mutable analog.

SimpleRefClone

Similar to SimpleRef, but with the clone flag enabled. This will provide a Clone impl for the struct as long as the prefix fields are CloneStableDeref and the suffix is Clone . Notice that the head is an Arc, since a clone of an Arc will deref to the same object as the original.

SimpleRefClone_Borrow

Shared borrow of a rental struct.

SimpleRefClone_BorrowMut

Mutable borrow of a rental struct.

SimpleRefCovariant

Identical to SimpleRef, but with the covariant flag enabled. For rental structs where the field types have covariant lifetimes, this will allow you to directly borrow the fields, as they can be safely reborrowed to a shorter lifetime. See the all and suffix methods.

SimpleRefCovariant_Borrow

Shared borrow of a rental struct.

SimpleRefCovariant_BorrowMut

Mutable borrow of a rental struct.

SimpleRefDebug

Identical to SimpleRef, but with the debug flag enabled. This will provide a Debug impl for the struct as long as all of the fields are Debug.

SimpleRefDebug_Borrow

Shared borrow of a rental struct.

SimpleRefDebug_BorrowMut

Mutable borrow of a rental struct.

SimpleRefDeref

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.

SimpleRefDeref_Borrow

Shared borrow of a rental struct.

SimpleRefDeref_BorrowMut

Mutable borrow of a rental struct.

SimpleRefMap

Identical to SimpleRef, but with the map_suffix flag enabled. This will allow the type of the suffix to be changed by mapping it to another instantiation of the same struct with the different type param. See the map, try_map, and try_map_or_drop methods.

SimpleRefMap_Borrow

Shared borrow of a rental struct.

SimpleRefMap_BorrowMut

Mutable borrow of a rental struct.

SimpleRef_Borrow

Shared borrow of a rental struct.

SimpleRef_BorrowMut

Mutable borrow of a rental struct.