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 which Formed 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 the FormingEnd<Formed, Context> trait, which defines how the final transformation or construction of Formed is handled, potentially using the provided Context.

Required Associated Types§

source

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 the FormingEnd<Formed, Context> trait, which defines how the final transformation or construction of Formed is handled, potentially using the provided Context.

Required Methods§

source

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 of Formed.

  • on_end - A closure or handler of type Self::End that is invoked at the completion of the subforming process. This handler is responsible for applying any final transformations to Formed and potentially utilizing Context to influence the outcome.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<E, Formed, Context, End> FormerBegin<Formed, Formed, Context> for VectorSubformer<E, Formed, Context, End>
where End: FormingEnd<Formed, Context>, Formed: VectorLike<E> + Default,

§

type End = End