pub struct Controller {
pub metadata: MetaData,
pub kind: ControllerKind,
pub status: ControllerStatus,
}Fields§
§metadata: MetaData§kind: ControllerKind§status: ControllerStatusLatest status of the controller. Does not need to be specified by the user when creating (POST), as it is initialized with the default values.
Implementations§
Source§impl Controller
impl Controller
pub fn new(name: SclName, kind: ControllerKind) -> Self
pub fn update_last_interaction(&mut self)
Trait Implementations§
Source§impl Clone for Controller
impl Clone for Controller
Source§fn clone(&self) -> Controller
fn clone(&self) -> Controller
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Controller
impl Debug for Controller
Source§impl<'de> Deserialize<'de> for Controller
impl<'de> Deserialize<'de> for Controller
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Controller
impl Ord for Controller
Source§fn cmp(&self, other: &Controller) -> Ordering
fn cmp(&self, other: &Controller) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Controller
impl PartialEq for Controller
Source§impl PartialOrd for Controller
impl PartialOrd for Controller
Source§impl SclObject for Controller
impl SclObject for Controller
Source§const PREFIX: &'static str = "/controllers"
const PREFIX: &'static str = "/controllers"
Prefix for all Controllers ("/controllers").
Source§fn api_endpoint<'a>(
_sc: impl Into<Option<&'a str>>,
name: impl Into<Option<&'a str>>,
) -> String
fn api_endpoint<'a>( _sc: impl Into<Option<&'a str>>, name: impl Into<Option<&'a str>>, ) -> String
Overrides the default implementation of the SclObject trait to ignore the sc argument
when constructing API endpoints.
§Examples
use scl_lib::api_objects::{Controller, SclObject};
assert_eq!(Controller::api_endpoint(None, "ctrl-01"), "/controllers/ctrl-01");
assert_eq!(Controller::api_endpoint(None, "ctrl-01"), Controller::api_endpoint("ctrl-01", "ctrl-01"));
assert_eq!(Controller::api_endpoint("ctrl-01", None), Controller::api_endpoint(None, None));
assert_eq!(Controller::api_endpoint(None, None), Controller::PREFIX);Source§fn db_key<'a>(
_sc: impl Into<Option<&'a str>>,
name: impl Into<Option<&'a str>>,
) -> String
fn db_key<'a>( _sc: impl Into<Option<&'a str>>, name: impl Into<Option<&'a str>>, ) -> String
Overrides the default implementation of the SclObject trait to use either the sc or the
name argument for DB key construction.
§Examples
use scl_lib::api_objects::{Controller, SclObject};
assert_eq!(Controller::db_key(None, "ctrl-01"), "/controllers/ctrl-01");
assert_eq!(Controller::db_key(None, "ctrl-01"), Controller::db_key("ctrl-01", "ctrl-01"));
assert_eq!(Controller::db_key("ctrl-01", None), Controller::db_key(None, None));
assert_eq!(Controller::db_key(None, None), Controller::PREFIX);Source§fn metadata(&self) -> &MetaData
fn metadata(&self) -> &MetaData
Providing access to
MetaData is essential for our optimistic concurrency control.Source§fn metadata_mut(&mut self) -> &mut MetaData
fn metadata_mut(&mut self) -> &mut MetaData
Providing access to
MetaData is essential for our optimistic concurrency control.Source§fn referenced_db_keys(&self) -> Vec<String>
fn referenced_db_keys(&self) -> Vec<String>
Returns all DB keys the object is referencing / depending on.
Source§fn validate_fields_before_create(&self) -> Result<(), Error>
fn validate_fields_before_create(&self) -> Result<(), Error>
Checks if all fields (except references to other SclObjects) are legal initial fields.
Should be called before a create operation.
Source§fn validate_fields_before_update(
current_db_state: &Self,
proposed_new_state: &Self,
) -> Result<(), Error>
fn validate_fields_before_update( current_db_state: &Self, proposed_new_state: &Self, ) -> Result<(), Error>
Checks if a proposed updated is valid. Should be called before a regular (not
related to finalizers / deletion) update operation.
fn uuid(&self) -> Uuid
Source§fn separation_context(&self) -> Option<&SclName>
fn separation_context(&self) -> Option<&SclName>
Returns the
SclName of the separation context if the SclObject is connected to one,
otherwise default None.Source§impl Serialize for Controller
impl Serialize for Controller
impl Eq for Controller
impl StructuralPartialEq for Controller
Auto Trait Implementations§
impl Freeze for Controller
impl RefUnwindSafe for Controller
impl Send for Controller
impl Sync for Controller
impl Unpin for Controller
impl UnwindSafe for Controller
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.