pub trait Apply: Sized {
// Required methods
fn apply(&self, closure: impl FnOnce(&Self)) -> &Self;
fn apply_mut(&mut self, closure: impl FnOnce(&mut Self)) -> &mut Self;
fn try_apply<E>(
&self,
closure: impl FnOnce(&Self) -> Result<(), E>,
) -> Result<&Self, E>;
fn try_apply_mut<E>(
&mut self,
closure: impl FnOnce(&mut Self) -> Result<(), E>,
) -> Result<&mut Self, E>;
}
Required Methods§
Sourcefn apply(&self, closure: impl FnOnce(&Self)) -> &Self
fn apply(&self, closure: impl FnOnce(&Self)) -> &Self
Calls the specified closure
with Self
as an argument and returns Self
.
Sourcefn apply_mut(&mut self, closure: impl FnOnce(&mut Self)) -> &mut Self
fn apply_mut(&mut self, closure: impl FnOnce(&mut Self)) -> &mut Self
Calls the specified closure
with mutable Self
as an argument and returns Self
.
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.