pub struct SetterImpl<S, A, SETTER: Setter<S, A>>(pub SETTER, _);Expand description
A wrapper of the Setter optic implementations, encapsulating a setter function.
SetterImpl provides a way to define setters - optics that are able to write to a focued value
of type A from a source of type S.
This struct is particularly useful in scenarios where you need to allow a callee to write into a
struct without being able to read its contents.
§Note
This struct is not intended to be created by users directly, but it implements a From<Setter<S,A>> so that implementors of new optic types can wrap their concrete implementation of a Setter optic.
§Type Parameters
S: The source type from which the value is to be retrieved.A: The target type of the value to be retrieved.
§See Also
Settertrait for defining custom partial getters.- [
mapped_setter] function for creatingSetterImplinstances from mapping functions.
Tuple Fields§
§0: SETTERTrait Implementations§
Source§impl<S, A, SETTER: Setter<S, A>> From<SETTER> for SetterImpl<S, A, SETTER>
impl<S, A, SETTER: Setter<S, A>> From<SETTER> for SetterImpl<S, A, SETTER>
Auto Trait Implementations§
impl<S, A, SETTER> Freeze for SetterImpl<S, A, SETTER>where
SETTER: Freeze,
impl<S, A, SETTER> RefUnwindSafe for SetterImpl<S, A, SETTER>
impl<S, A, SETTER> Send for SetterImpl<S, A, SETTER>
impl<S, A, SETTER> Sync for SetterImpl<S, A, SETTER>
impl<S, A, SETTER> Unpin for SetterImpl<S, A, SETTER>
impl<S, A, SETTER> UnwindSafe for SetterImpl<S, A, SETTER>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more