Trait former::exposed::FormerBegin
source · pub trait FormerBegin<Storage, Formed, Context> {
type End: FormingEnd<Formed, Context>;
// Required method
fn _begin(
storage: Option<Storage>,
context: Option<Context>,
on_end: Self::End
) -> Self;
}
Expand description
A trait defining the initialization process for a subformer with contextual linkage.
This trait is designed for types that need to initiate a subforming process,
passing themselves as the context and specifying a closure or handler (on_end
) to be
called upon completion. It facilitates the construction of builder pattern chains
that maintain stateful context through each step of the process.
§Type Parameters
Formed
- Represents the type that is being constructed or transformed by the subformer.Context
- Denotes the contextual information or the environment in whichFormed
is being formed. This could be a reference to a parent builder, configuration settings, or any other relevant state.
§Associated Types
End
- Specifies the trait bound for the closure or handler that gets called at the completion of the subforming process. This type must implement theFormingEnd<Formed, Context>
trait, which defines how the final transformation or construction ofFormed
is handled, potentially using the providedContext
.
Required Associated Types§
sourcetype End: FormingEnd<Formed, Context>
type End: FormingEnd<Formed, Context>
End
- Specifies the trait bound for the closure or handler that gets called at the completion of the subforming process. This type must implement theFormingEnd<Formed, Context>
trait, which defines how the final transformation or construction ofFormed
is handled, potentially using the providedContext
.
Required Methods§
sourcefn _begin(
storage: Option<Storage>,
context: Option<Context>,
on_end: Self::End
) -> Self
fn _begin( storage: Option<Storage>, context: Option<Context>, on_end: Self::End ) -> Self
Initializes the subforming process by setting the context and specifying an on_end
completion handler.
This function is the entry point for initiating a subforming sequence, allowing the caller to establish initial contextual information and define how the process concludes.
§Parameters
-
context
- An optional parameter providing initial context for the subforming process. This might include configuration data, references to parent structures, or any state relevant to the formation ofFormed
. -
on_end
- A closure or handler of typeSelf::End
that is invoked at the completion of the subforming process. This handler is responsible for applying any final transformations toFormed
and potentially utilizingContext
to influence the outcome.