#[repr(C)]pub struct SubscriptionInfo { /* private fields */ }Expand description
One active subscription as reported by the uSubscription service.
Implementations§
Source§impl SubscriptionInfo
impl SubscriptionInfo
Sourcepub fn new(
topic: UUri,
subscriber: UUri,
status: SubscriptionStatus,
expiration: Option<u64>,
min_sample_period: Option<u32>,
) -> Self
pub fn new( topic: UUri, subscriber: UUri, status: SubscriptionStatus, expiration: Option<u64>, min_sample_period: Option<u32>, ) -> Self
Creates a new info object.
§Arguments
topic- The topic of the subscription.subscriber- The uEntity that has established the subscription.status- The status of the subscription.expiration- The point in time at which the subscription expires (milliseconds since Unix epoch). If not specified, the subscription is valid until explicitly unsubscribed.min_sample_period- The minimum duration (in seconds) between two events that should be maintained for remote only topics. Device dispatchers use this attribute to reduce the publication rates of events sent between devices. This attribute is commonly used for mobile/cloud components subscribing to vehicle topics that are published at a high rate. If the desired sampling period set by the subscriber is lower than the original publisher’s publication period, the attribute is ignored. If not specified, the sampling period is set by the publisher.
Sourcepub fn subscriber(&self) -> &UUri
pub fn subscriber(&self) -> &UUri
Returns the subscriber’s URI.
Sourcepub fn status(&self) -> &SubscriptionStatus
pub fn status(&self) -> &SubscriptionStatus
Returns the subscription’s current status.
Sourcepub fn expiration(&self) -> &Option<u64>
pub fn expiration(&self) -> &Option<u64>
Returns the subscription’s expiration time, if bounded.
Sourcepub fn min_sample_period(&self) -> &Option<u32>
pub fn min_sample_period(&self) -> &Option<u32>
Returns the minimum sample period, if rate-limited.
Sourcepub fn has_status(&self, state: SubscriptionStatus) -> bool
pub fn has_status(&self, state: SubscriptionStatus) -> bool
Checks for a specific subscription status.
§Examples
use up_rust::{communication::SubscriptionStatus, UUri};
use up_rust::core::usubscription::SubscriptionInfo;
let subscription_info = SubscriptionInfo::new(
UUri::try_from("/A100/1/9000").unwrap(),
UUri::try_from("//subscriber/ABCD/1/0").unwrap(),
SubscriptionStatus::Subscribed,
None,
None,
);
assert!(subscription_info.has_status(SubscriptionStatus::Subscribed));
assert!(!subscription_info.has_status(SubscriptionStatus::Unsubscribed));Trait Implementations§
Source§impl Clone for SubscriptionInfo
impl Clone for SubscriptionInfo
Source§fn clone(&self) -> SubscriptionInfo
fn clone(&self) -> SubscriptionInfo
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SubscriptionInfo
impl Debug for SubscriptionInfo
Source§impl PartialEq for SubscriptionInfo
impl PartialEq for SubscriptionInfo
impl StructuralPartialEq for SubscriptionInfo
Auto Trait Implementations§
impl Freeze for SubscriptionInfo
impl RefUnwindSafe for SubscriptionInfo
impl Send for SubscriptionInfo
impl Sync for SubscriptionInfo
impl Unpin for SubscriptionInfo
impl UnwindSafe for SubscriptionInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.