Trait svc_storage::resources::base::simple_resource::SimpleResource
source · pub trait SimpleResource<T>: Resource + PsqlType + ObjectType<T>where
T: GrpcDataObjectType,{
// Provided methods
fn get_id(&self) -> Option<String> { ... }
fn set_id(&mut self, id: String) { ... }
fn try_get_id(&self) -> Result<String, ArrErr> { ... }
fn try_get_uuid(&self) -> Result<Uuid, ArrErr> { ... }
}Expand description
Generic trait providing specific functions for our simple resources
Provided Methods§
sourcefn get_id(&self) -> Option<String>
fn get_id(&self) -> Option<String>
Returns Some<String> with the value of SimpleResource<T>’s id field
Returns None if no id field was found in T’s ResourceDefinition
Returns None if the id field value is not set
sourcefn set_id(&mut self, id: String)
fn set_id(&mut self, id: String)
Set SimpleResource<T>’s id String
Logs an error if no id field was found in T’s ResourceDefinition
sourcefn try_get_id(&self) -> Result<String, ArrErr>
fn try_get_id(&self) -> Result<String, ArrErr>
Returns SimpleResource<T>’s id String
Errors
Returns ArrErr “No id provided for GenericResource when calling [try_get_id]” if the id field is None
Object Safety§
This trait is not object safe.