Skip to main content

FetchEvent

Trait FetchEvent 

Source
pub trait FetchEvent:
    Copy
    + Send
    + Sync {
    // Required methods
    fn get<T>(
        self,
        event_id: &EventId,
    ) -> impl Future<Output = Result<T>> + Send
       where T: for<'de> Deserialize<'de> + Send;
    fn exists(
        self,
        event_id: &EventId,
    ) -> impl Future<Output = Result<bool>> + Send;
}
Expand description

Reads events through a copyable handle to their storage.

Callers borrow identifiers and choose the fields they need to decode. Implementations apply the caller’s missing-event policy.

Required Methods§

Source

fn get<T>(self, event_id: &EventId) -> impl Future<Output = Result<T>> + Send
where T: for<'de> Deserialize<'de> + Send,

Decodes an event into the requested representation.

Missing-event handling follows the caller’s completeness policy.

Source

fn exists(self, event_id: &EventId) -> impl Future<Output = Result<bool>> + Send

Checks whether an event exists without requiring a full decode.

Missing events yield false unless the caller requires completeness.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<E, X, EFut, XFut> FetchEvent for (&E, &X)
where E: Fn(OwnedEventId) -> EFut + Sync, X: Fn(OwnedEventId) -> XFut + Sync, EFut: Future<Output = Result<PduEvent>> + Send, XFut: Future<Output = Result<bool>> + Send,

Source§

fn get<T>(self, event_id: &EventId) -> impl Future<Output = Result<T>> + Send
where T: for<'de> Deserialize<'de> + Send,

Source§

fn exists(self, event_id: &EventId) -> impl Future<Output = Result<bool>> + Send

Source§

impl<F, Fut> FetchEvent for &F
where F: Fn(OwnedEventId) -> Fut + Sync, Fut: Future<Output = Result<PduEvent>> + Send,

Source§

async fn get<T>(self, event_id: &EventId) -> Result<T>
where T: for<'de> Deserialize<'de> + Send,

Source§

async fn exists(self, event_id: &EventId) -> Result<bool>

Source§

impl<S: BuildHasher + Sync> FetchEvent for &HashMap<OwnedEventId, PduEvent, S>

Source§

fn get<T>(self, event_id: &EventId) -> impl Future<Output = Result<T>> + Send
where T: for<'de> Deserialize<'de> + Send,

Source§

fn exists(self, event_id: &EventId) -> impl Future<Output = Result<bool>> + Send

Source§

impl<S: BuildHasher + Sync> FetchEvent for &HashMap<OwnedEventId, Vec<u8>, S>

Source§

fn get<T>(self, event_id: &EventId) -> impl Future<Output = Result<T>> + Send
where T: for<'de> Deserialize<'de> + Send,

Source§

fn exists(self, event_id: &EventId) -> impl Future<Output = Result<bool>> + Send

Implementors§