pub struct Finalizers {
inner: Vec<FinalizerId>,
}Expand description
A sequence of FinalizerIds that should be processed in the right order, one by one. Deletion may performed only if there is no FinalizerId left to process.
Similar to a Stack except that no new elements can be pushed to the data structure after it has been created.
§Examples
use scl_lib::api_objects::{Finalizers, FinalizerId::*};
let fs = vec![ForceRemoveVMs, ForceRemoveVolumes];
let mut finalizers = Finalizers::from(fs);
assert_eq!(finalizers.take_next_finalizer(), Some(ForceRemoveVMs));
assert_eq!(finalizers.next_finalizer(), Some(&ForceRemoveVolumes));
let _ = finalizers.take_next_finalizer();
assert!(finalizers.may_be_deleted());Fields§
§inner: Vec<FinalizerId>Implementations§
Source§impl Finalizers
impl Finalizers
Sourcepub fn may_be_deleted(&self) -> bool
pub fn may_be_deleted(&self) -> bool
Returns true if no finalizer remains.
Sourcepub fn next_finalizer(&self) -> Option<&FinalizerId>
pub fn next_finalizer(&self) -> Option<&FinalizerId>
Returns a reference of the next FinalizerId that should be processed.
Sourcepub fn take_next_finalizer(&mut self) -> Option<FinalizerId>
pub fn take_next_finalizer(&mut self) -> Option<FinalizerId>
Pops the next FinalizerId that should be processed.
Sourcepub fn identify_removed_finalizer(
current_state: &Self,
proposed_new_state: &Self,
) -> Result<FinalizerId>
pub fn identify_removed_finalizer( current_state: &Self, proposed_new_state: &Self, ) -> Result<FinalizerId>
Identifies which finalizer has been removed.
The function performs a transition validation since this is a prerequisite.
Sourcepub fn iter(&self) -> Iter<'_, FinalizerId>
pub fn iter(&self) -> Iter<'_, FinalizerId>
Provides an iterator over the finalizers.
Trait Implementations§
Source§impl Clone for Finalizers
impl Clone for Finalizers
Source§fn clone(&self) -> Finalizers
fn clone(&self) -> Finalizers
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 Finalizers
impl Debug for Finalizers
Source§impl<'de> Deserialize<'de> for Finalizers
impl<'de> Deserialize<'de> for Finalizers
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 From<Vec<FinalizerId>> for Finalizers
impl From<Vec<FinalizerId>> for Finalizers
Source§fn from(vec: Vec<FinalizerId>) -> Self
fn from(vec: Vec<FinalizerId>) -> Self
Converts to this type from the input type.
Source§impl Ord for Finalizers
impl Ord for Finalizers
Source§fn cmp(&self, other: &Finalizers) -> Ordering
fn cmp(&self, other: &Finalizers) -> 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 Finalizers
impl PartialEq for Finalizers
Source§impl PartialOrd for Finalizers
impl PartialOrd for Finalizers
Source§impl Serialize for Finalizers
impl Serialize for Finalizers
impl Eq for Finalizers
impl StructuralPartialEq for Finalizers
Auto Trait Implementations§
impl Freeze for Finalizers
impl RefUnwindSafe for Finalizers
impl Send for Finalizers
impl Sync for Finalizers
impl Unpin for Finalizers
impl UnwindSafe for Finalizers
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.