Struct config_it::entity::Metadata

source ·
pub struct Metadata {
    pub name: &'static str,
    pub type_id: TypeId,
    pub v_default: Arc<dyn EntityTrait>,
    pub v_min: Option<Box<dyn EntityTrait>>,
    pub v_max: Option<Box<dyn EntityTrait>>,
    pub v_one_of: Vec<Box<dyn EntityTrait>>,
    pub props: MetadataProps,
    pub fn_default: fn() -> Box<dyn EntityTrait>,
    pub fn_copy_to: fn(_: &dyn Any, _: &mut dyn Any),
    pub fn_serialize_to: fn(_: &dyn Any, _: &mut dyn Serializer) -> Result<(), Error>,
    pub fn_deserialize_from: fn(_: &mut dyn Any, _: &mut dyn Deserializer<'_>) -> Result<(), Error>,
    pub fn_validate: fn(_: &Metadata, _: &mut dyn Any) -> Option<bool>,
}
Expand description

Metadata for configuration entity. This can be used as template for multiple config entity instances.

Fields§

§name: &'static str

Identifier for this config entity.

§type_id: TypeId§v_default: Arc<dyn EntityTrait>§v_min: Option<Box<dyn EntityTrait>>§v_max: Option<Box<dyn EntityTrait>>§v_one_of: Vec<Box<dyn EntityTrait>>§props: MetadataProps§fn_default: fn() -> Box<dyn EntityTrait>§fn_copy_to: fn(_: &dyn Any, _: &mut dyn Any)§fn_serialize_to: fn(_: &dyn Any, _: &mut dyn Serializer) -> Result<(), Error>§fn_deserialize_from: fn(_: &mut dyn Any, _: &mut dyn Deserializer<'_>) -> Result<(), Error>§fn_validate: fn(_: &Metadata, _: &mut dyn Any) -> Option<bool>

Returns None if validation failed. Some(false) when source value was corrected. Some(true) when value was correct.

Implementations§

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.