xmtp_api_d14n/queries/v3/
to_dyn_api.rs

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