pub trait GuardedExt:
Sealed
+ Guarded
+ Sized {
// Provided methods
fn map<F, T>(this: Self, f: F) -> Mapped<Self, T>
where F: FnOnce(&<Self as Guarded>::Target) -> &T,
T: ?Sized { ... }
fn try_map<F, T, E>(this: Self, f: F) -> Result<Mapped<Self, T>, E>
where F: FnOnce(&<Self as Guarded>::Target) -> Result<&T, E>,
T: ?Sized { ... }
}
Expand description
An extension trait for convenience methods, that is automatically implemented for all
Guarded
types.
Provided Methods§
Sourcefn map<F, T>(this: Self, f: F) -> Mapped<Self, T>
fn map<F, T>(this: Self, f: F) -> Mapped<Self, T>
Apply a function to the pointee, creating a new guarded type that dereferences into the result of that function.
The closure is only evaluated once, and the resulting wrapper will only store one null-optimizable additional word, for the reference.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.