EntityStore

Struct EntityStore 

Source
pub struct EntityStore<E, MV = NoMac> { /* private fields */ }

Implementations§

Source§

impl<E, MV> EntityStore<E, MV>

Source

pub fn new(entity: Option<E>) -> Self

Source

pub fn new_default() -> Self
where E: Default,

Source

pub fn reset(&self, entity: Option<E>)

Source

pub fn reset_to_default(&self)
where E: Default,

Source

pub fn replace(&self, entity: Option<E>) -> Option<E>

Source

pub fn empty(&self) -> bool

Source

pub fn not_empty(&self) -> bool

Source

pub fn empty_signal(&self) -> impl Signal<Item = bool> + use<E, MV>

Source

pub fn not_empty_signal(&self) -> impl Signal<Item = bool> + use<E, MV>

Source

pub fn invalidate(&self)

Source

pub fn transfer_state(&self) -> &Mutable<TransferState>

Source

pub fn set_transfer_state(&self, transfer_state: TransferState)

Source

pub fn reset_transfer_error(&self)

Source

pub fn loaded(&self) -> bool

Source

pub fn loaded_signal(&self) -> impl Signal<Item = bool> + use<E, MV>

Source

pub fn loaded_status(&self) -> Option<StatusCode>

Source

pub fn loaded_status_signal( &self, ) -> impl Signal<Item = Option<StatusCode>> + use<E, MV>

Source

pub fn stored(&self) -> bool

Source

pub fn stored_signal(&self) -> impl Signal<Item = bool> + use<E, MV>

Source

pub fn stored_status(&self) -> Option<StatusCode>

Source

pub fn stored_status_signal( &self, ) -> impl Signal<Item = Option<StatusCode>> + use<E, MV>

Source

pub fn pending(&self) -> bool

Source

pub fn pending_signal(&self) -> impl Signal<Item = bool> + use<E, MV>

Source

pub fn entity(&self) -> &MutableOption<E>

Source

pub fn messages(&self) -> &Messages

Source

pub fn dirty_signal(&self) -> impl Signal<Item = bool> + use<E, MV>
where E: Dirty,

Source

pub fn messages_error_signal(&self) -> impl Signal<Item = bool> + use<E, MV>

Source

pub fn can_commit_signal(&self) -> impl Signal<Item = bool> + use<E, MV>
where E: Dirty,

Source

pub fn signal_map<F, U>(&self, f: F) -> impl Signal<Item = U> + use<E, MV, F, U>
where F: FnMut(Option<&E>) -> U,

Source

pub fn signal_map_some<F, U>( &self, f: F, ) -> impl Signal<Item = Option<U>> + use<E, MV, F, U>
where F: FnMut(&E) -> U,

Source

pub fn signal_map_some_or<F, U>( &self, f: F, default: U, ) -> impl Signal<Item = U> + use<E, MV, F, U>
where F: FnMut(&E) -> U, U: Clone,

Source

pub fn signal_map_some_or_else<F, D, U>( &self, f: F, default: D, ) -> impl Signal<Item = U> + use<E, MV, F, D, U>
where F: FnMut(&E) -> U, D: FnOnce() -> U + Clone,

Source

pub fn signal_and_then_some<F, U>( &self, f: F, ) -> impl Signal<Item = Option<U>> + use<E, MV, F, U>
where F: FnMut(&E) -> Option<U>,

Source

pub fn signal_and_then_some_or<F, U>( &self, f: F, default: U, ) -> impl Signal<Item = U> + use<E, MV, F, U>
where F: FnMut(&E) -> Option<U>, U: Clone,

Source

pub fn signal_and_then_some_or_else<F, D, U>( &self, f: F, default: D, ) -> impl Signal<Item = U> + use<E, MV, F, D, U>
where F: FnMut(&E) -> Option<U>, D: FnOnce() -> U + Clone,

Source

pub fn signal_map_some_default<F, U>( &self, f: F, ) -> impl Signal<Item = U> + use<E, MV, F, U>
where F: FnMut(&E) -> U, U: Default,

Source

pub fn lock_ref(&self) -> MutableLockRef<'_, Option<E>>

Source

pub fn lock_mut(&self) -> MutableLockMut<'_, Option<E>>

Source

pub fn inspect<F>(&self, f: F)
where F: FnOnce(&E),

Source

pub fn inspect_mut<F>(&self, f: F)
where F: FnOnce(&mut E),

Source

pub fn inspect_mut_map<F, U>(&self, f: F) -> Option<U>
where F: FnOnce(&mut E) -> U,

Source

pub fn map<F, U>(&self, f: F) -> Option<U>
where F: FnOnce(&E) -> U,

Source

pub fn map_or_default<F, U>(&self, f: F) -> U
where F: FnOnce(&E) -> U, U: Default,

Source

pub fn and_then<F, U>(&self, f: F) -> Option<U>
where F: FnOnce(&E) -> Option<U>,

Source

pub fn get(&self) -> Option<E>
where E: Copy,

Source

pub fn get_cloned(&self) -> Option<E>
where E: Clone,

Source

pub fn set(&self, entity: Option<E>)

Source

pub fn set_neq(&self, entity: Option<E>)
where E: PartialEq,

Source

pub fn set_externally_loaded(&self, entity: Option<E>)

Source

pub fn set_inner<I>(&self, entity: Option<I>)
where E: Inner<I>,

Source

pub fn set_inner_neq<I>(&self, entity: Option<I>)
where E: PartialEq + Inner<I>,

Source

pub fn set_externally_loaded_inner<I>(&self, entity: Option<I>)
where E: Inner<I>,

Source§

impl<E, MV> EntityStore<E, MV>
where MV: MacVerify,

Source

pub fn load<C>(&self, request: Request<'_>, result_callback: C)
where E: DeserializeOwned + 'static, C: FnOnce(StatusCode) + 'static,

Source

pub fn load_skip_cache<C>(&self, request: Request<'_>, result_callback: C)
where E: DeserializeOwned + 'static, C: FnOnce(StatusCode) + 'static,

Source

pub fn load_with_request<MS, R, C>( &self, request: Request<'_>, request_entity: MutableOption<R>, result_callback: C, )
where E: DeserializeOwned + 'static, MS: MacSign, R: Serialize, C: FnOnce(StatusCode) + 'static,

Source

pub fn execute<C>(&self, request: Request<'_>, result_callback: C)
where C: FnOnce(StatusCode) + 'static,

Source

pub fn execute_with_response<R, C>( &self, request: Request<'_>, response_entity: MutableOption<R>, result_callback: C, )
where R: DeserializeOwned + 'static, C: FnOnce(StatusCode) + 'static,

Source

pub fn store<MS, C>(&self, request: Request<'_>, result_callback: C)
where E: Serialize + DeserializeOwned + 'static, MS: MacSign, C: FnOnce(StatusCode) + 'static,

Source

pub fn store_with_response<MS, R, C>( &self, request: Request<'_>, response_entity: MutableOption<R>, result_callback: C, )
where E: Serialize, MS: MacSign, R: DeserializeOwned + 'static, C: FnOnce(StatusCode) + 'static,

Trait Implementations§

Source§

impl<E: Debug, MV: Debug> Debug for EntityStore<E, MV>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E, MV> Default for EntityStore<E, MV>

Source§

fn default() -> Self

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

impl<E, MV> From<&EntityStore<E, MV>> for Messages

Source§

fn from(store: &EntityStore<E, MV>) -> Self

Converts to this type from the input type.
Source§

impl<E, MV> From<&EntityStore<E, MV>> for MutableOption<E>
where E: Clone,

Source§

fn from(store: &EntityStore<E, MV>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<E, MV> Freeze for EntityStore<E, MV>

§

impl<E, MV> RefUnwindSafe for EntityStore<E, MV>
where MV: RefUnwindSafe,

§

impl<E, MV> Send for EntityStore<E, MV>
where MV: Send, E: Send + Sync,

§

impl<E, MV> Sync for EntityStore<E, MV>
where MV: Sync, E: Send + Sync,

§

impl<E, MV> Unpin for EntityStore<E, MV>
where MV: Unpin,

§

impl<E, MV> UnwindSafe for EntityStore<E, MV>
where MV: 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.