GlobalProperty

Trait GlobalProperty 

Source
pub trait GlobalProperty: Any {
    type Value: Any;

    // Required methods
    fn new() -> Self;
    fn validate(value: &Self::Value) -> Result<(), Box<dyn Error + 'static>>;

    // Provided method
    fn name() -> &'static str { ... }
}
Expand description

The trait representing a global property. Do not use this directly, but instead define global properties with define_global_property!.

Validation errors are produced by client code and should be returned as Box<dyn std::error::Error + 'static>. Ixa wraps those values in IxaError::IllegalGlobalPropertyValue when a global property is set or loaded.

Required Associated Types§

Source

type Value: Any

The actual type of the data stored in the global property

Required Methods§

Source

fn new() -> Self

Source

fn validate(value: &Self::Value) -> Result<(), Box<dyn Error + 'static>>

A function which validates the global property.

Client code should box any produced error itself.

Provided Methods§

Source

fn name() -> &'static str

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§