Skip to main content

xmtp_mls/groups/
context.rs

1//! The context the engine runs on.
2
3use crate::context::CoreContext;
4use crate::identity_updates::IdentityContext;
5use crate::subscriptions::incoming::IncomingRuntime;
6
7/// The engine's feature slot: the client's incoming runtime.
8pub trait EngineFeatures {
9    fn incoming(&self) -> &IncomingRuntime;
10}
11
12/// A context the engine runs on: core, identity resolution and the incoming
13/// runtime.
14pub trait XmtpSharedContext: IdentityContext + CoreContext<Features: EngineFeatures> {
15    /// Shared incoming runtime. Its limits and transport are internal client policy.
16    fn incoming_runtime(&self) -> &IncomingRuntime {
17        self.features().incoming()
18    }
19}
20
21impl<T: IdentityContext + CoreContext<Features: EngineFeatures>> XmtpSharedContext for T {}