Skip to main content

Property

Trait Property 

Source
pub trait Property: Send + Sync {
    // Required methods
    fn set_href_prefix(&mut self, prefix: String);
    fn get_href(&self) -> String;
    fn get_value(&self) -> Value;
    fn set_value(&mut self, value: Value) -> Result<(), &'static str>;
    fn set_cached_value(&mut self, value: Value) -> Result<(), &'static str>;
    fn get_name(&self) -> String;
    fn get_metadata(&self) -> Map<String, Value>;

    // Provided methods
    fn validate_value(&self, value: &Value) -> Result<(), &'static str> { ... }
    fn as_property_description(&self) -> Map<String, Value> { ... }
}
Expand description

High-level Property trait.

Required Methods§

Source

fn set_href_prefix(&mut self, prefix: String)

Set the prefix of any hrefs associated with this property.

Source

fn get_href(&self) -> String

Get the href of this property.

Source

fn get_value(&self) -> Value

Get the current property value.

Source

fn set_value(&mut self, value: Value) -> Result<(), &'static str>

Set the current value of the property with the value forwarder.

Source

fn set_cached_value(&mut self, value: Value) -> Result<(), &'static str>

Set the cached value of the property.

Source

fn get_name(&self) -> String

Get the name of this property.

Source

fn get_metadata(&self) -> Map<String, Value>

Get the metadata associated with this property.

Provided Methods§

Source

fn validate_value(&self, value: &Value) -> Result<(), &'static str>

Validate new property value before setting it.

Returns a result indicating validity.

Source

fn as_property_description(&self) -> Map<String, Value>

Get the property description.

Returns a JSON value describing the property.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§