pub trait SimpleResource<T>: Resource + PsqlType + ObjectType<T>{
    // 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§

source

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

source

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

source

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

source

fn try_get_uuid(&self) -> Result<Uuid, ArrErr>

Returns SimpleResource<T>’s id String as Uuid

Errors

Returns ArrErr if the id String could not be converted to a valid Uuid

Object Safety§

This trait is not object safe.

Implementors§