Struct rental::MapMut
[−]
[src]
pub struct MapMut;
A mapper that can convert one rental into another, provided they have identical owner types.
Methods
impl MapMut
[src]
fn map<'rental, T: 'rental, U: ?Sized + 'rental, T__, U__, F__>(t: T__,
f: F__)
-> U__ where T__: Rental<Rental=&'rental mut T>, U__: Rental<Owner=T__::Owner, Rental=&'rental mut U>, F__: for<'f__: 'rental> FnOnce(&'f__ mut T) -> &'f__ mut U
f: F__)
-> U__ where T__: Rental<Rental=&'rental mut T>, U__: Rental<Owner=T__::Owner, Rental=&'rental mut U>, F__: for<'f__: 'rental> FnOnce(&'f__ mut T) -> &'f__ mut U
Maps from one rental to another. The closure assumes ownership
of the rented value and converts it into a new value. A new
rental pair is then returned to you from the original owner and
the new value. As with other rental closures, the 'rental
lifetime is existential to prevent improper escaping or
replacement.
fn try_map<'rental, T: 'rental, U: ?Sized + 'rental, T__, U__, E__, F__>(t: T__,
f: F__)
-> Result<U__, (E__, T__)> where T__: Rental<Rental=&'rental mut T>, U__: Rental<Owner=T__::Owner, Rental=&'rental mut U>, F__: for<'f__: 'rental> FnOnce(&'f__ mut T) -> Result<&'f__ mut U, (E__, &'f__ mut T)>
f: F__)
-> Result<U__, (E__, T__)> where T__: Rental<Rental=&'rental mut T>, U__: Rental<Owner=T__::Owner, Rental=&'rental mut U>, F__: for<'f__: 'rental> FnOnce(&'f__ mut T) -> Result<&'f__ mut U, (E__, &'f__ mut T)>
As map
, but the closure may fail. In addition
to the error value, the closure must also return the rented
value in the tuple, so that the original rented pair can be
reconstituted and given back to you in the error tuple returned
by this method.