MutationCapability

Trait MutationCapability 

pub trait MutationCapability:
    'static
    + Clone
    + PartialEq
    + Hash
    + Eq {
    type Ok;
    type Err;
    type Keys: Hash + PartialEq + Clone;

    // Required method
    fn run(
        &self,
        keys: &Self::Keys,
    ) -> impl Future<Output = Result<Self::Ok, Self::Err>>;

    // Provided methods
    fn matches(&self, _keys: &Self::Keys) -> bool { ... }
    fn on_settled(
        &self,
        _keys: &Self::Keys,
        _result: &Result<Self::Ok, Self::Err>,
    ) -> impl Future<Output = ()> { ... }
}
Available on crate feature query only.

Required Associated Types§

type Ok

type Err

type Keys: Hash + PartialEq + Clone

Required Methods§

fn run( &self, keys: &Self::Keys, ) -> impl Future<Output = Result<Self::Ok, Self::Err>>

Mutation logic.

Provided Methods§

fn matches(&self, _keys: &Self::Keys) -> bool

Implement a custom logic to check if this mutation should be invalidated or not given a MutationCapability::Keys.

fn on_settled( &self, _keys: &Self::Keys, _result: &Result<Self::Ok, Self::Err>, ) -> impl Future<Output = ()>

Runs after MutationCapability::run. You may use this method to invalidate crate::query::Querys.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§