Skip to main content

DelegateJmapReads

Trait DelegateJmapReads 

Source
pub trait DelegateJmapReads: JmapAccounts {
    type Target: JmapReads<Error = Self::Error, CallerCtx = Self::CallerCtx>;

    // Required method
    fn jmap_reads(&self) -> &Self::Target;
}
Expand description

Forward JmapReads to another backend: implement this instead of JmapReads, and the blanket impl sends every read to Self::jmap_reads.

For a wrapper that overrides JmapAccounts methods (an account_exists that consults a directory, say) but serves the reads from the backend it wraps. The target has the same Error and CallerCtx as the wrapper.

ⓘ
impl JmapAccounts for Wrapper {
    type Error = <Inner as JmapAccounts>::Error;
    type CallerCtx = <Inner as JmapAccounts>::CallerCtx;
    async fn account_exists(&self, caller: &Self::CallerCtx, id: &Id) -> Result<bool, Self::Error> {
        // ...
    }
}

impl DelegateJmapReads for Wrapper {
    type Target = Inner;
    fn jmap_reads(&self) -> &Inner {
        &self.inner
    }
}

Required Associated Types§

Source

type Target: JmapReads<Error = Self::Error, CallerCtx = Self::CallerCtx>

The backend the reads go to.

Required Methods§

Source

fn jmap_reads(&self) -> &Self::Target

The backend the reads go to.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§