pub trait HasEntity: Default {
// Required methods
fn generate_id(&mut self);
fn generate_href(&mut self);
fn get_id(&self) -> String;
fn get_href(&self) -> String;
fn get_class() -> String;
fn get_class_href() -> String;
fn get_mod_path() -> String;
fn set_id(&mut self, id: impl Into<String>);
fn id(self, id: impl Into<String>) -> Self;
// Provided methods
fn get_uuid() -> String { ... }
fn get_full_href(&self, hostname: impl Into<String>) -> String { ... }
fn create() -> Self { ... }
}Expand description
Trait indicating a TMF struct has and id, href fields defined in an Entity struct
Required Methods§
Sourcefn generate_id(&mut self)
fn generate_id(&mut self)
Generate and store a new ID. This will also regenerated the HREF field via generate_href()
Sourcefn generate_href(&mut self)
fn generate_href(&mut self)
Generate a new HTML reference.
§Details
This is usually triggered directly from generate_id() but can be manually triggered.
Sourcefn get_class() -> String
fn get_class() -> String
Get the class of this object. This is also used to form part of the URL via generate_href()
Sourcefn get_class_href() -> String
fn get_class_href() -> String
Get Class HREF, this represents the generate path to the class.
Sourcefn get_mod_path() -> String
fn get_mod_path() -> String
Get the module path
Provided Methods§
Sourcefn get_full_href(&self, hostname: impl Into<String>) -> String
fn get_full_href(&self, hostname: impl Into<String>) -> String
Generate a complete URL for a given hostname
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.