Skip to main content

ValueGenerator

Trait ValueGenerator 

Source
pub trait ValueGenerator:
    Send
    + Sync
    + 'static {
    // Required methods
    fn exec(
        &self,
        ctx: &Context<'_, '_>,
        value: &str,
        mode: ValueGeneratorMode,
    ) -> Result<Box<dyn ValueRenderer>, Error>;
    fn clone(&self) -> Box<dyn ValueGenerator>;
}
Expand description

Trait that converts the value of a element specified in the XML schema to actual code.

You can add a custom default value implementation to your custom type using CustomMeta::with_default.

Required Methods§

Source

fn exec( &self, ctx: &Context<'_, '_>, value: &str, mode: ValueGeneratorMode, ) -> Result<Box<dyn ValueRenderer>, Error>

Try to convert the passed string value that contains the default value from the XML schema to actual default code. If the value could not be converted to code None is returned.

Source

fn clone(&self) -> Box<dyn ValueGenerator>

Clone this instance and return it as a box.

Implementors§

Source§

impl<X> ValueGenerator for X
where X: Fn(&Context<'_, '_>, &str, ValueGeneratorMode) -> Result<Box<dyn ValueRenderer>, Error> + Clone + Send + Sync + 'static,