Trait mz_adapter::session::Var

source ·
pub trait Var: Debug {
    // Required methods
    fn name(&self) -> &'static str;
    fn value(&self) -> String;
    fn description(&self) -> &'static str;
    fn type_name(&self) -> Cow<'static, str>;
    fn visible(
        &self,
        user: &User,
        system_vars: Option<&SystemVars>
    ) -> Result<(), VarError>;

    // Provided method
    fn as_var(&self) -> &dyn Var
       where Self: Sized { ... }
}
Expand description

A Var represents a configuration parameter of an arbitrary type.

Required Methods§

source

fn name(&self) -> &'static str

Returns the name of the configuration parameter.

source

fn value(&self) -> String

Constructs a flattened string representation of the current value of the configuration parameter.

The resulting string is guaranteed to be parsable if provided to Value::parse as a VarInput::Flat.

source

fn description(&self) -> &'static str

Returns a short sentence describing the purpose of the configuration parameter.

source

fn type_name(&self) -> Cow<'static, str>

Returns the name of the type of this variable.

source

fn visible( &self, user: &User, system_vars: Option<&SystemVars> ) -> Result<(), VarError>

Indicates wither the Var is visible as a function of the user and system_vars. “Invisible” parameters return VarErrors.

Variables marked as internal are only visible for the system user.

Provided Methods§

source

fn as_var(&self) -> &dyn Var
where Self: Sized,

Upcast self to a dyn Var, useful when working with multiple different implementors of Var.

Implementations on Foreign Types§

source§

impl Var for BuildInfo

source§

fn name(&self) -> &'static str

source§

fn value(&self) -> String

source§

fn description(&self) -> &'static str

source§

fn type_name(&self) -> Cow<'static, str>

source§

fn visible(&self, _: &User, _: Option<&SystemVars>) -> Result<(), VarError>

Implementors§