Struct former::exposed::VectorSubformer
source · pub struct VectorSubformer<E, Formed, Context, ContainerEnd>{ /* private fields */ }
Expand description
A builder for constructing VectorLike
containers, facilitating a fluent and flexible interface.
VectorSubformer
leverages the VectorLike
trait to enable the construction and manipulation
of vector-like containers in a builder pattern style, promoting readability and ease of use.
§Example
#[ derive( Debug, PartialEq, former::Former ) ]
pub struct StructWithVec
{
#[ subformer( former::VectorSubformer ) ]
vec : Vec< &'static str >,
}
let instance = StructWithVec::former()
.vec()
.push( "apple" )
.push( "banana" )
.end()
.form();
assert_eq!( instance, StructWithVec { vec: vec![ "apple", "banana" ] } );
Implementations§
source§impl<E, Formed, Context, ContainerEnd> VectorSubformer<E, Formed, Context, ContainerEnd>
impl<E, Formed, Context, ContainerEnd> VectorSubformer<E, Formed, Context, ContainerEnd>
source§impl<E, Formed> VectorSubformer<E, Formed, Formed, ReturnFormed>where
Formed: VectorLike<E> + Default,
impl<E, Formed> VectorSubformer<E, Formed, Formed, ReturnFormed>where
Formed: VectorLike<E> + Default,
source§impl<E, Formed, Context, ContainerEnd> VectorSubformer<E, Formed, Context, ContainerEnd>
impl<E, Formed, Context, ContainerEnd> VectorSubformer<E, Formed, Context, ContainerEnd>
Trait Implementations§
source§impl<E: Debug, Formed, Context: Debug, ContainerEnd> Debug for VectorSubformer<E, Formed, Context, ContainerEnd>
impl<E: Debug, Formed, Context: Debug, ContainerEnd> Debug for VectorSubformer<E, Formed, Context, ContainerEnd>
source§impl<E: Default, Formed, Context: Default, ContainerEnd> Default for VectorSubformer<E, Formed, Context, ContainerEnd>where
Formed: VectorLike<E> + Default + Default,
ContainerEnd: FormingEnd<Formed, Context> + Default,
impl<E: Default, Formed, Context: Default, ContainerEnd> Default for VectorSubformer<E, Formed, Context, ContainerEnd>where
Formed: VectorLike<E> + Default + Default,
ContainerEnd: FormingEnd<Formed, Context> + Default,
source§fn default() -> VectorSubformer<E, Formed, Context, ContainerEnd>
fn default() -> VectorSubformer<E, Formed, Context, ContainerEnd>
Returns the “default value” for a type. Read more
source§impl<E, Formed, Context, End> FormerBegin<Formed, Formed, Context> for VectorSubformer<E, Formed, Context, End>
impl<E, Formed, Context, End> FormerBegin<Formed, Formed, Context> for VectorSubformer<E, Formed, Context, End>
§type End = End
type End = End
End
- Specifies the trait bound for the closure or handler that gets called at the completion
of the subforming process. This type must implement the FormingEnd<Formed, Context>
trait, which defines how the final transformation or construction of Formed
is handled,
potentially using the provided Context
. Read moreAuto Trait Implementations§
impl<E, Formed, Context, ContainerEnd> Freeze for VectorSubformer<E, Formed, Context, ContainerEnd>
impl<E, Formed, Context, ContainerEnd> RefUnwindSafe for VectorSubformer<E, Formed, Context, ContainerEnd>
impl<E, Formed, Context, ContainerEnd> Send for VectorSubformer<E, Formed, Context, ContainerEnd>
impl<E, Formed, Context, ContainerEnd> Sync for VectorSubformer<E, Formed, Context, ContainerEnd>
impl<E, Formed, Context, ContainerEnd> Unpin for VectorSubformer<E, Formed, Context, ContainerEnd>
impl<E, Formed, Context, ContainerEnd> UnwindSafe for VectorSubformer<E, Formed, Context, ContainerEnd>
Blanket Implementations§
source§impl<S> AssignWithType for S
impl<S> AssignWithType for S
source§fn assign_with_type<T, IntoT>(&mut self, component: IntoT)where
IntoT: Into<T>,
S: ComponentAssign<T, IntoT>,
fn assign_with_type<T, IntoT>(&mut self, component: IntoT)where
IntoT: Into<T>,
S: ComponentAssign<T, IntoT>,
Function to set value of a component by its type.
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