Skip to main content

OptativeSet

Struct OptativeSet 

Source
pub struct OptativeSet<T: Lifecycle> { /* private fields */ }

Implementations§

Source§

impl<T: Lifecycle> OptativeSet<T>
where T::Error: Debug,

Source

pub fn new() -> Self

Source

pub fn with_initial_state( items: impl IntoIterator<Item = (T::Key, T::State)>, ) -> Self

Seed the set with (key, state) pairs without calling enter. For items that already exist outside the lifecycle (processes, files, windows); the next reconcile treats them as present.

Source

pub fn get(&self, key: &T::Key) -> Option<&T::State>

Source

pub fn iter(&self) -> impl Iterator<Item = (&T::Key, &T::State)>

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = (&T::Key, &mut T::State)>

Source

pub fn get_mut(&mut self, key: &T::Key) -> Option<&mut T::State>

Trait Implementations§

Source§

impl<T: Lifecycle> Default for OptativeSet<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Lifecycle> Reconcile<T> for OptativeSet<T>
where T::Error: Debug,

Source§

fn reconcile( &mut self, desired: impl IntoIterator<Item = T>, ctx: &mut T::Context, output: &mut T::Output, ) -> ReconcileErrors<T::Key, T::Error>

Auto Trait Implementations§

§

impl<T> Freeze for OptativeSet<T>

§

impl<T> RefUnwindSafe for OptativeSet<T>

§

impl<T> Send for OptativeSet<T>
where <T as Lifecycle>::Key: Send, <T as Lifecycle>::State: Send,

§

impl<T> Sync for OptativeSet<T>
where <T as Lifecycle>::Key: Sync, <T as Lifecycle>::State: Sync,

§

impl<T> Unpin for OptativeSet<T>
where <T as Lifecycle>::Key: Unpin, <T as Lifecycle>::State: Unpin,

§

impl<T> UnsafeUnpin for OptativeSet<T>

§

impl<T> UnwindSafe for OptativeSet<T>
where <T as Lifecycle>::Key: UnwindSafe, <T as Lifecycle>::State: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.