pub struct Subscriber<T>where
T: UZeroCopyTransport + ?Sized,{ /* private fields */ }Expand description
Role: the up-L2 subscribe surface over a selected-wire zero-copy transport (experimental) — see the trait map.
Mirrors the owned-frame Subscriber:
the uSubscription service is informed first, and the zero-copy listener is
registered only when the service reports the subscription active or
pending. Received payloads are delivered as the transport’s lease type —
for a selected-wire transport that is UWireRx, whose
decode_payload reads the typed value in
place.
Implementations§
Source§impl<T> Subscriber<T>where
T: UZeroCopyTransport + ?Sized,
impl<T> Subscriber<T>where
T: UZeroCopyTransport + ?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 a zero-copy transport and a uSubscription service client.
Sourcepub async fn subscribe(
&self,
topic: &UUri,
listener: Arc<dyn UZeroCopyListener<T::Rx>>,
) -> Result<(), RegistrationError>
pub async fn subscribe( &self, topic: &UUri, listener: Arc<dyn UZeroCopyListener<T::Rx>>, ) -> Result<(), RegistrationError>
Subscribes to a topic: informs the uSubscription service first, then registers the zero-copy listener on success.
§Errors
Returns an error if the topic is not a valid subscription filter, if the uSubscription service rejects the subscription or reports a state other than active/pending, or if listener registration fails.
Sourcepub async fn unsubscribe(
&self,
topic: &UUri,
listener: Arc<dyn UZeroCopyListener<T::Rx>>,
) -> Result<(), RegistrationError>
pub async fn unsubscribe( &self, topic: &UUri, listener: Arc<dyn UZeroCopyListener<T::Rx>>, ) -> Result<(), RegistrationError>
Unsubscribes from a topic: informs the uSubscription service, then unregisters the zero-copy listener.
§Errors
Returns an error if the topic is not a valid subscription filter, or if the service call or listener unregistration fails.