xmtp_api_d14n/queries/d14n/
to_dyn_api.rs

1use std::error::Error;
2use std::sync::Arc;
3
4use xmtp_common::RetryableError;
5use xmtp_proto::api::ApiClientError;
6use xmtp_proto::api::{Client, IsConnectedCheck};
7
8use crate::protocol::FullXmtpApiArc;
9use crate::protocol::FullXmtpApiBox;
10use crate::{BoxedStreamsClient, D14nClient, ToDynApi, protocol::CursorStore};
11
12impl<M, Store, E> ToDynApi for D14nClient<M, Store>
13where
14    E: Error + RetryableError + 'static,
15    M: Client<Error = E> + IsConnectedCheck + 'static,
16    Store: CursorStore + Clone + 'static,
17    <M as Client>::Stream: 'static,
18{
19    type Error = ApiClientError<E>;
20    fn boxed(self) -> FullXmtpApiBox<Self::Error> {
21        Box::new(BoxedStreamsClient::new(self))
22    }
23
24    fn arced(self) -> FullXmtpApiArc<Self::Error> {
25        Arc::new(BoxedStreamsClient::new(self))
26    }
27}