use crate::Result;
#[derive(Clone, Debug)]
pub struct Publisher<T>
where
T: super::stub::Publisher + std::fmt::Debug + Send + Sync,
{
inner: T,
}
impl<T> Publisher<T>
where
T: super::stub::Publisher + std::fmt::Debug + Send + Sync,
{
pub fn new(inner: T) -> Self {
Self { inner }
}
}
impl<T> super::stub::Publisher for Publisher<T>
where
T: super::stub::Publisher + std::fmt::Debug + Send + Sync,
{
#[tracing::instrument(ret)]
async fn publish(
&self,
req: crate::model::PublishRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<crate::model::PublishResponse>> {
self.inner.publish(req, options).await
}
}
#[derive(Clone, Debug)]
pub struct Subscriber<T>
where
T: super::stub::Subscriber + std::fmt::Debug + Send + Sync,
{
inner: T,
}
impl<T> Subscriber<T>
where
T: super::stub::Subscriber + std::fmt::Debug + Send + Sync,
{
pub fn new(inner: T) -> Self {
Self { inner }
}
}
impl<T> super::stub::Subscriber for Subscriber<T>
where
T: super::stub::Subscriber + std::fmt::Debug + Send + Sync,
{
#[tracing::instrument(ret)]
async fn modify_ack_deadline(
&self,
req: crate::model::ModifyAckDeadlineRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<()>> {
self.inner.modify_ack_deadline(req, options).await
}
#[tracing::instrument(ret)]
async fn acknowledge(
&self,
req: crate::model::AcknowledgeRequest,
options: crate::RequestOptions,
) -> Result<crate::Response<()>> {
self.inner.acknowledge(req, options).await
}
}