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§
Sourcefn set_href_prefix(&mut self, prefix: String)
fn set_href_prefix(&mut self, prefix: String)
Set the prefix of any hrefs associated with this property.
Sourcefn set_value(&mut self, value: Value) -> Result<(), &'static str>
fn set_value(&mut self, value: Value) -> Result<(), &'static str>
Set the current value of the property with the value forwarder.
Sourcefn set_cached_value(&mut self, value: Value) -> Result<(), &'static str>
fn set_cached_value(&mut self, value: Value) -> Result<(), &'static str>
Set the cached value of the property.
Sourcefn get_metadata(&self) -> Map<String, Value>
fn get_metadata(&self) -> Map<String, Value>
Get the metadata associated with this property.
Provided Methods§
Sourcefn validate_value(&self, value: &Value) -> Result<(), &'static str>
fn validate_value(&self, value: &Value) -> Result<(), &'static str>
Validate new property value before setting it.
Returns a result indicating validity.
Sourcefn as_property_description(&self) -> Map<String, Value>
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".