pub struct TopicRef<P, T, E = Json, O = Unordered> { /* private fields */ }Expand description
A reference to a Topic carrying T, encoded as E, that grants only
the permissions P, made by Topic::reference. Copy, and free to pass
to other code.
Its methods are the topic’s, for the permissions it grants: a
TopicRef<perms::Publisher, T> can publish. Each is also a method of
its permission’s trait — Publisher, or OrderedPublisher on an
OrderedTopicRef — which library code takes instead of a TopicRef.
Implementations§
Source§impl<T, E: Encoding<T>> TopicRef<Publisher, T, E, Unordered>
impl<T, E: Encoding<T>> TopicRef<Publisher, T, E, Unordered>
Sourcepub async fn publish_with(
&self,
data: &T,
options: PublishOptions,
) -> Result<String, Error>
pub async fn publish_with( &self, data: &T, options: PublishOptions, ) -> Result<String, Error>
See Topic::publish_with.
Sourcepub async fn publish_batch(
&self,
messages: &[BatchMessage<'_, T>],
) -> Result<Vec<String>, BatchError>
pub async fn publish_batch( &self, messages: &[BatchMessage<'_, T>], ) -> Result<Vec<String>, BatchError>
See Topic::publish_batch.
Source§impl<T, E: Encoding<T>> TopicRef<Publisher, T, E, Ordered>
impl<T, E: Encoding<T>> TopicRef<Publisher, T, E, Ordered>
Sourcepub async fn publish(
&self,
data: &T,
ordering_key: &str,
) -> Result<String, Error>
pub async fn publish( &self, data: &T, ordering_key: &str, ) -> Result<String, Error>
See Topic::publish.
Sourcepub async fn publish_with(
&self,
data: &T,
ordering_key: &str,
options: PublishOptions,
) -> Result<String, Error>
pub async fn publish_with( &self, data: &T, ordering_key: &str, options: PublishOptions, ) -> Result<String, Error>
See Topic::publish_with.
Sourcepub async fn publish_batch(
&self,
messages: &[OrderedBatchMessage<'_, T>],
) -> Result<Vec<String>, BatchError>
pub async fn publish_batch( &self, messages: &[OrderedBatchMessage<'_, T>], ) -> Result<Vec<String>, BatchError>
See Topic::publish_batch.
Trait Implementations§
impl<P, T, E, O> Copy for TopicRef<P, T, E, O>
Source§impl<T: Sync, E: Encoding<T>> OrderedPublisher<T> for TopicRef<Publisher, T, E, Ordered>
impl<T: Sync, E: Encoding<T>> OrderedPublisher<T> for TopicRef<Publisher, T, E, Ordered>
Source§fn publish_with(
&self,
data: &T,
ordering_key: &str,
options: PublishOptions,
) -> impl Future<Output = Result<String, Error>> + Send
fn publish_with( &self, data: &T, ordering_key: &str, options: PublishOptions, ) -> impl Future<Output = Result<String, Error>> + Send
See
Topic::publish_with.Source§fn publish_batch(
&self,
messages: &[OrderedBatchMessage<'_, T>],
) -> impl Future<Output = Result<Vec<String>, BatchError>> + Send
fn publish_batch( &self, messages: &[OrderedBatchMessage<'_, T>], ) -> impl Future<Output = Result<Vec<String>, BatchError>> + Send
See
Topic::publish_batch.Source§impl<T: Sync, E: Encoding<T>> Publisher<T> for TopicRef<Publisher, T, E, Unordered>
impl<T: Sync, E: Encoding<T>> Publisher<T> for TopicRef<Publisher, T, E, Unordered>
Source§fn publish_with(
&self,
data: &T,
options: PublishOptions,
) -> impl Future<Output = Result<String, Error>> + Send
fn publish_with( &self, data: &T, options: PublishOptions, ) -> impl Future<Output = Result<String, Error>> + Send
See
Topic::publish_with.Source§fn publish_batch(
&self,
messages: &[BatchMessage<'_, T>],
) -> impl Future<Output = Result<Vec<String>, BatchError>> + Send
fn publish_batch( &self, messages: &[BatchMessage<'_, T>], ) -> impl Future<Output = Result<Vec<String>, BatchError>> + Send
See
Topic::publish_batch.Auto Trait Implementations§
impl<P, T, E, O> Forget for TopicRef<P, T, E, O>
impl<P, T, E, O> Freeze for TopicRef<P, T, E, O>
impl<P, T, E, O> Move for TopicRef<P, T, E, O>
impl<P, T, E, O> RefUnwindSafe for TopicRef<P, T, E, O>
impl<P, T, E, O> Send for TopicRef<P, T, E, O>
impl<P, T, E, O> Sync for TopicRef<P, T, E, O>
impl<P, T, E, O> Unpin for TopicRef<P, T, E, O>
impl<P, T, E, O> UnsafeUnpin for TopicRef<P, T, E, O>
impl<P, T, E, O> UnwindSafe for TopicRef<P, T, E, O>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.