xmtp_api_d14n/queries/builder/
impls.rs1use std::sync::Arc;
2
3use xmtp_proto::types::{GlobalCursor, Topic};
4
5use crate::protocol::{XmtpEnvelope, XmtpQuery};
6
7#[xmtp_common::async_trait]
8impl<T> XmtpQuery for Box<T>
9where
10 T: XmtpQuery + ?Sized,
11{
12 type Error = T::Error;
13
14 async fn query_at(
16 &self,
17 topic: Topic,
18 at: Option<GlobalCursor>,
19 ) -> Result<XmtpEnvelope, Self::Error> {
20 <T as XmtpQuery>::query_at(&**self, topic, at).await
21 }
22}
23
24#[xmtp_common::async_trait]
25impl<T> XmtpQuery for Arc<T>
26where
27 T: XmtpQuery + ?Sized,
28{
29 type Error = T::Error;
30
31 async fn query_at(
33 &self,
34 topic: Topic,
35 at: Option<GlobalCursor>,
36 ) -> Result<XmtpEnvelope, Self::Error> {
37 <T as XmtpQuery>::query_at(&**self, topic, at).await
38 }
39}