pub struct Subscriber<T>where
T: UOwnedTransport + ?Sized,{ /* private fields */ }Expand description
Subscriber implemented over an owned native-frame transport.
Role: the up-L2 Subscriber for the owned family. Like its UTransport-family
sibling, subscription is a service interaction: it requires a
USubscription client and
informs the uSubscription service before registering the local listener,
per the uProtocol specification.
Implementations§
Source§impl<T> Subscriber<T>where
T: UOwnedTransport + ?Sized,
impl<T> Subscriber<T>where
T: UOwnedTransport + ?Sized,
Sourcepub fn new(transport: Arc<T>, usubscription: Arc<dyn USubscription>) -> Self
pub fn new(transport: Arc<T>, usubscription: Arc<dyn USubscription>) -> Self
Creates a subscriber over an owned-frame transport and a uSubscription service client.
Sourcepub async fn subscribe(
&self,
topic: &UUri,
handler: Arc<dyn UListener>,
subscription_change_handler: Option<Arc<dyn SubscriptionChangeHandler>>,
) -> Result<(), RegistrationError>
pub async fn subscribe( &self, topic: &UUri, handler: Arc<dyn UListener>, subscription_change_handler: Option<Arc<dyn SubscriptionChangeHandler>>, ) -> Result<(), RegistrationError>
Subscribes to a topic: informs the uSubscription service first, then registers the owned-frame listener on success.
Sourcepub async fn unsubscribe(
&self,
topic: &UUri,
handler: Arc<dyn UListener>,
) -> Result<(), RegistrationError>
pub async fn unsubscribe( &self, topic: &UUri, handler: Arc<dyn UListener>, ) -> Result<(), RegistrationError>
Unsubscribes from a topic: informs the uSubscription service, then unregisters the owned-frame listener.
Trait Implementations§
Source§impl<T> Debug for Subscriber<T>where
T: UOwnedTransport + ?Sized,
impl<T> Debug for Subscriber<T>where
T: UOwnedTransport + ?Sized,
Source§impl<T> Subscriber for Subscriber<T>where
T: UOwnedTransport + ?Sized,
impl<T> Subscriber for Subscriber<T>where
T: UOwnedTransport + ?Sized,
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
handler: Arc<dyn UListener>,
subscription_change_handler: Option<Arc<dyn SubscriptionChangeHandler>>,
) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
handler: Arc<dyn UListener>,
subscription_change_handler: Option<Arc<dyn SubscriptionChangeHandler>>,
) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Registers a handler to invoke for messages that have been published to a given topic. Read more
Source§fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
handler: Arc<dyn UListener>,
) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 UUri,
handler: Arc<dyn UListener>,
) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deregisters a previously registered handler. Read more
Auto Trait Implementations§
impl<T> !Freeze for Subscriber<T>
impl<T> !RefUnwindSafe for Subscriber<T>
impl<T> Send for Subscriber<T>where
T: ?Sized,
impl<T> Sync for Subscriber<T>where
T: ?Sized,
impl<T> Unpin for Subscriber<T>where
T: ?Sized,
impl<T> !UnwindSafe for Subscriber<T>
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<TCore> UWithNativePrefixWire for TCore
impl<TCore> UWithNativePrefixWire for TCore
Source§fn into_native_prefix_wire_transport<W>(
self,
wire: W,
) -> UWireTransport<TCore, W, NativePrefixFrameMetadataCodec>where
W: UWire,
fn into_native_prefix_wire_transport<W>(
self,
wire: W,
) -> UWireTransport<TCore, W, NativePrefixFrameMetadataCodec>where
W: UWire,
Wraps this core with an external or custom selected wire using canonical metadata.
Source§fn into_protobuf_transport(
self,
) -> UWireTransport<TCore, ProtobufWire, NativePrefixFrameMetadataCodec>
fn into_protobuf_transport( self, ) -> UWireTransport<TCore, ProtobufWire, NativePrefixFrameMetadataCodec>
Wraps this core with the Protocol Buffers selected-wire profile.
Source§fn into_stable_container_transport(
self,
) -> UWireTransport<TCore, StableContainerWireFormat, NativePrefixFrameMetadataCodec>
fn into_stable_container_transport( self, ) -> UWireTransport<TCore, StableContainerWireFormat, NativePrefixFrameMetadataCodec>
Wraps this core with the stable-container selected-wire profile.