pub struct SeparationContext {
pub metadata: MetaData,
pub vlan_tag: VlanTag,
}Fields§
§metadata: MetaData§vlan_tag: VlanTagValues provided by the client will be ignored as vlan tags will be assigned by the server and may not change afterwards.
Trait Implementations§
Source§impl Clone for SeparationContext
impl Clone for SeparationContext
Source§fn clone(&self) -> SeparationContext
fn clone(&self) -> SeparationContext
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 SeparationContext
impl Debug for SeparationContext
Source§impl<'de> Deserialize<'de> for SeparationContext
impl<'de> Deserialize<'de> for SeparationContext
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 SeparationContext
impl Ord for SeparationContext
Source§fn cmp(&self, other: &SeparationContext) -> Ordering
fn cmp(&self, other: &SeparationContext) -> 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 SeparationContext
impl PartialEq for SeparationContext
Source§impl PartialOrd for SeparationContext
impl PartialOrd for SeparationContext
Source§impl SclObject for SeparationContext
impl SclObject for SeparationContext
Source§const PREFIX: &'static str = "/scs"
const PREFIX: &'static str = "/scs"
Prefix for all SeparationContexts ("/scs").
Source§fn separation_context(&self) -> Option<&SclName>
fn separation_context(&self) -> Option<&SclName>
Returns the SclName of the SeparationContext, as each separation context is associated with itself.
§Examples
use scl_lib::api_objects::{MetaData, SclName, SclObject, SeparationContext, VlanTag};
let sc = SeparationContext {
vlan_tag: VlanTag::try_from(1).unwrap(),
metadata: MetaData::new(SclName::try_from("sc-01").unwrap()),
};
assert_eq!(sc.separation_context(), Some(sc.name()));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 use either the sc or the
name argument for API endpoint construction.
§Examples
use scl_lib::api_objects::{SeparationContext, SclObject};
assert_eq!(SeparationContext::api_endpoint("sc-01", None), SeparationContext::api_endpoint(None, "sc-01"));
assert_eq!(SeparationContext::api_endpoint("sc-01", "sc-01"), SeparationContext::api_endpoint("sc-01", None));
assert_eq!(SeparationContext::api_endpoint(None, None), SeparationContext::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::{SeparationContext, SclObject};
assert_eq!(SeparationContext::db_key("sc-01", None), SeparationContext::db_key(None, "sc-01"));
assert_eq!(SeparationContext::db_key("sc-01", "sc-01"), SeparationContext::db_key("sc-01", None));
assert_eq!(SeparationContext::db_key(None, None), SeparationContext::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<()>
fn validate_fields_before_create(&self) -> Result<()>
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<()>
fn validate_fields_before_update( _current_db_state: &Self, _proposed_new_state: &Self, ) -> Result<()>
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§impl Serialize for SeparationContext
impl Serialize for SeparationContext
impl Eq for SeparationContext
impl StructuralPartialEq for SeparationContext
Auto Trait Implementations§
impl Freeze for SeparationContext
impl RefUnwindSafe for SeparationContext
impl Send for SeparationContext
impl Sync for SeparationContext
impl Unpin for SeparationContext
impl UnwindSafe for SeparationContext
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.