pub struct UAttributes {Show 13 fields
pub id: MessageField<UUID>,
pub type_: EnumOrUnknown<UMessageType>,
pub source: MessageField<UUri>,
pub sink: MessageField<UUri>,
pub priority: EnumOrUnknown<UPriority>,
pub ttl: Option<u32>,
pub permission_level: Option<u32>,
pub commstatus: Option<EnumOrUnknown<UCode>>,
pub reqid: MessageField<UUID>,
pub token: Option<String>,
pub traceparent: Option<String>,
pub payload_format: EnumOrUnknown<UPayloadFormat>,
pub special_fields: SpecialFields,
}Fields§
§id: MessageField<UUID>§type_: EnumOrUnknown<UMessageType>§source: MessageField<UUri>§sink: MessageField<UUri>§priority: EnumOrUnknown<UPriority>§ttl: Option<u32>§permission_level: Option<u32>§commstatus: Option<EnumOrUnknown<UCode>>§reqid: MessageField<UUID>§token: Option<String>§traceparent: Option<String>§payload_format: EnumOrUnknown<UPayloadFormat>§special_fields: SpecialFieldsImplementations§
Source§impl UAttributes
impl UAttributes
Sourcepub fn type_(&self) -> Option<UMessageType>
pub fn type_(&self) -> Option<UMessageType>
Gets the type of message these are the attributes of.
§Example
use up_rust::{UAttributes, UMessageType};
let attribs = UAttributes {
type_: UMessageType::UMESSAGE_TYPE_PUBLISH.into(),
..Default::default()
};
assert_eq!(attribs.type_(), Some(UMessageType::UMESSAGE_TYPE_PUBLISH));Sourcepub fn type_unchecked(&self) -> UMessageType
pub fn type_unchecked(&self) -> UMessageType
Gets the type of message these are the attributes of.
§Panics
if the property has no value.
§Example
use up_rust::{UAttributes, UMessageType};
let attribs = UAttributes {
type_: UMessageType::UMESSAGE_TYPE_PUBLISH.into(),
..Default::default()
};
assert_eq!(attribs.type_unchecked(), UMessageType::UMESSAGE_TYPE_PUBLISH);Sourcepub fn id(&self) -> Option<&UUID>
pub fn id(&self) -> Option<&UUID>
Gets the identifier of the message these attributes belong to.
§Example
use up_rust::{UAttributes, UUID};
let msg_id = UUID::build();
let attribs = UAttributes {
id: Some(msg_id.clone()).into(),
..Default::default()
};
assert_eq!(attribs.id(), Some(&msg_id));Sourcepub fn id_unchecked(&self) -> &UUID
pub fn id_unchecked(&self) -> &UUID
Gets the identifier of the message these attributes belong to.
§Panics
if the property has no value.
§Example
use up_rust::{UAttributes, UUID};
let msg_id = UUID::build();
let attribs = UAttributes {
id: Some(msg_id.clone()).into(),
..Default::default()
};
assert_eq!(attribs.id_unchecked(), &msg_id);Sourcepub fn source(&self) -> Option<&UUri>
pub fn source(&self) -> Option<&UUri>
Gets the source address of the message these attributes belong to.
§Example
use up_rust::{UAttributes, UUri};
let src = UUri::try_from_parts("vehicle", 0xaabb, 0x01, 0x9000).unwrap();
let attribs = UAttributes {
source: Some(src.clone()).into(),
..Default::default()
};
assert_eq!(attribs.source(), Some(&src));Sourcepub fn source_unchecked(&self) -> &UUri
pub fn source_unchecked(&self) -> &UUri
Gets the source address of the message these attributes belong to.
§Panics
if the property has no value.
§Example
use up_rust::{UAttributes, UUri};
let src = UUri::try_from_parts("vehicle", 0xaabb, 0x01, 0x9000).unwrap();
let attribs = UAttributes {
source: Some(src.clone()).into(),
..Default::default()
};
assert_eq!(attribs.source_unchecked(), &src);Sourcepub fn sink(&self) -> Option<&UUri>
pub fn sink(&self) -> Option<&UUri>
Gets the sink address of the message these attributes belong to.
§Example
use up_rust::{UAttributes, UUri};
let sink = UUri::try_from_parts("vehicle", 0xaabb, 0x01, 0x9000).unwrap();
let attribs = UAttributes {
sink: Some(sink.clone()).into(),
..Default::default()
};
assert_eq!(attribs.sink(), Some(&sink));Sourcepub fn sink_unchecked(&self) -> &UUri
pub fn sink_unchecked(&self) -> &UUri
Gets the sink address of the message these attributes belong to.
§Panics
if the property has no value.
§Example
use up_rust::{UAttributes, UUri};
let sink = UUri::try_from_parts("vehicle", 0xaabb, 0x01, 0x9000).unwrap();
let attribs = UAttributes {
sink: Some(sink.clone()).into(),
..Default::default()
};
assert_eq!(attribs.sink_unchecked(), &sink);Sourcepub fn priority(&self) -> Option<UPriority>
pub fn priority(&self) -> Option<UPriority>
Gets the priority of the message these attributes belong to.
§Example
use up_rust::{UAttributes, UPriority};
let attribs = UAttributes {
priority: UPriority::UPRIORITY_CS2.into(),
..Default::default()
};
assert_eq!(attribs.priority(), Some(UPriority::UPRIORITY_CS2));Sourcepub fn priority_unchecked(&self) -> UPriority
pub fn priority_unchecked(&self) -> UPriority
Gets the priority of the message these attributes belong to.
§Panics
if the property has no value.
§Example
use up_rust::{UAttributes, UPriority};
let attribs = UAttributes {
priority: UPriority::UPRIORITY_CS2.into(),
..Default::default()
};
assert_eq!(attribs.priority_unchecked(), UPriority::UPRIORITY_CS2);Sourcepub fn commstatus(&self) -> Option<UCode>
pub fn commstatus(&self) -> Option<UCode>
Gets the commstatus of the message these attributes belong to.
§Example
use up_rust::{UAttributes, UCode};
let attribs = UAttributes {
commstatus: Some(UCode::OK.into()),
..Default::default()
};
assert_eq!(attribs.commstatus(), Some(UCode::OK));Sourcepub fn commstatus_unchecked(&self) -> UCode
pub fn commstatus_unchecked(&self) -> UCode
Sourcepub fn ttl_unchecked(&self) -> u32
pub fn ttl_unchecked(&self) -> u32
Sourcepub fn permission_level(&self) -> Option<u32>
pub fn permission_level(&self) -> Option<u32>
Gets the permission level of the message these attributes belong to.
§Example
use up_rust::{UAttributes};
let attribs = UAttributes {
permission_level: Some(10),
..Default::default()
};
assert_eq!(attribs.permission_level(), Some(10));Sourcepub fn token(&self) -> Option<&String>
pub fn token(&self) -> Option<&String>
Gets the token of the message these attributes belong to.
§Example
use up_rust::{UAttributes};
let token = "my_token".to_string();
let attribs = UAttributes {
token: Some(token.clone()),
..Default::default()
};
assert_eq!(attribs.token(), Some(&token));Sourcepub fn traceparent(&self) -> Option<&String>
pub fn traceparent(&self) -> Option<&String>
Gets the traceparent of the message these attributes belong to.
§Example
use up_rust::{UAttributes};
let traceparent = "my_traceparent".to_string();
let attribs = UAttributes {
traceparent: Some(traceparent.clone()),
..Default::default()
};
assert_eq!(attribs.traceparent(), Some(&traceparent));Sourcepub fn request_id(&self) -> Option<&UUID>
pub fn request_id(&self) -> Option<&UUID>
Gets the request identifier of the message these attributes belong to.
§Example
use up_rust::{UAttributes, UUID};
let req_id = UUID::build();
let attribs = UAttributes {
reqid: Some(req_id.clone()).into(),
..Default::default()
};
assert_eq!(attribs.request_id(), Some(&req_id));Sourcepub fn request_id_unchecked(&self) -> &UUID
pub fn request_id_unchecked(&self) -> &UUID
Gets the request identifier of the message these attributes belong to.
§Panics
if the property has no value.
§Example
use up_rust::{UAttributes, UUID};
let req_id = UUID::build();
let attribs = UAttributes {
reqid: Some(req_id.clone()).into(),
..Default::default()
};
assert_eq!(attribs.request_id_unchecked(), &req_id);Sourcepub fn payload_format(&self) -> Option<UPayloadFormat>
pub fn payload_format(&self) -> Option<UPayloadFormat>
Gets the payload format of the message these attributes belong to.
§Example
use up_rust::{UAttributes, UPayloadFormat};
let attribs = UAttributes {
payload_format: UPayloadFormat::UPAYLOAD_FORMAT_JSON.into(),
..Default::default()
};
assert_eq!(attribs.payload_format(), Some(UPayloadFormat::UPAYLOAD_FORMAT_JSON));Sourcepub fn payload_format_unchecked(&self) -> UPayloadFormat
pub fn payload_format_unchecked(&self) -> UPayloadFormat
Gets the payload format of the message these attributes belong to.
§Panics
if the property has no value.
§Example
use up_rust::{UAttributes, UPayloadFormat};
let attribs = UAttributes {
payload_format: UPayloadFormat::UPAYLOAD_FORMAT_JSON.into(),
..Default::default()
};
assert_eq!(attribs.payload_format_unchecked(), UPayloadFormat::UPAYLOAD_FORMAT_JSON);Sourcepub fn is_publish(&self) -> bool
pub fn is_publish(&self) -> bool
Checks if these are the attributes for a Publish message.
§Examples
use up_rust::{UAttributes, UMessageType};
let attribs = UAttributes {
type_: UMessageType::UMESSAGE_TYPE_PUBLISH.into(),
..Default::default()
};
assert!(attribs.is_publish());Sourcepub fn is_request(&self) -> bool
pub fn is_request(&self) -> bool
Checks if these are the attributes for an RPC Request message.
§Examples
use up_rust::{UAttributes, UMessageType};
let attribs = UAttributes {
type_: UMessageType::UMESSAGE_TYPE_REQUEST.into(),
..Default::default()
};
assert!(attribs.is_request());Sourcepub fn is_response(&self) -> bool
pub fn is_response(&self) -> bool
Checks if these are the attributes for an RPC Response message.
§Examples
use up_rust::{UAttributes, UMessageType};
let attribs = UAttributes {
type_: UMessageType::UMESSAGE_TYPE_RESPONSE.into(),
..Default::default()
};
assert!(attribs.is_response());Sourcepub fn is_notification(&self) -> bool
pub fn is_notification(&self) -> bool
Checks if these are the attributes for a Notification message.
§Examples
use up_rust::{UAttributes, UMessageType};
let attribs = UAttributes {
type_: UMessageType::UMESSAGE_TYPE_NOTIFICATION.into(),
..Default::default()
};
assert!(attribs.is_notification());Sourcepub fn check_expired(&self) -> Result<(), UAttributesError>
pub fn check_expired(&self) -> Result<(), UAttributesError>
Checks if the message that is described by these attributes should be considered expired.
§Errors
Returns an error if Self::ttl (time-to-live) contains a value greater than 0, but
- the current system time cannot be determined, or
- the message has expired according to the timestamp extracted from
Self::idand the time-to-live value.
Sourcepub fn check_expired_for_reference(
&self,
reference_time: u128,
) -> Result<(), UAttributesError>
pub fn check_expired_for_reference( &self, reference_time: u128, ) -> Result<(), UAttributesError>
Checks if the message that is described by these attributes should be considered expired.
§Arguments
reference_time- The reference time as aDurationsince UNIX epoch. The check will be performed in relation to this point in time.
§Errors
Returns an error if Self::ttl (time-to-live) contains a value greater than 0, but
the message has expired according to the timestamp extracted from Self::id, the
time-to-live value and the provided reference time.
Source§impl UAttributes
impl UAttributes
pub fn new() -> UAttributes
Trait Implementations§
Source§impl Clone for UAttributes
impl Clone for UAttributes
Source§fn clone(&self) -> UAttributes
fn clone(&self) -> UAttributes
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UAttributes
impl Debug for UAttributes
Source§impl<'a> Default for &'a UAttributes
impl<'a> Default for &'a UAttributes
Source§fn default() -> &'a UAttributes
fn default() -> &'a UAttributes
Source§impl Default for UAttributes
impl Default for UAttributes
Source§fn default() -> UAttributes
fn default() -> UAttributes
Source§impl Display for UAttributes
impl Display for UAttributes
Source§impl Message for UAttributes
impl Message for UAttributes
Source§fn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
true for protobuf 3.Source§fn merge_from(&mut self, is: &mut CodedInputStream<'_>) -> Result<()>
fn merge_from(&mut self, is: &mut CodedInputStream<'_>) -> Result<()>
Source§fn compute_size(&self) -> u64
fn compute_size(&self) -> u64
Source§fn write_to_with_cached_sizes(
&self,
os: &mut CodedOutputStream<'_>,
) -> Result<()>
fn write_to_with_cached_sizes( &self, os: &mut CodedOutputStream<'_>, ) -> Result<()>
Source§fn special_fields(&self) -> &SpecialFields
fn special_fields(&self) -> &SpecialFields
Source§fn mut_special_fields(&mut self) -> &mut SpecialFields
fn mut_special_fields(&mut self) -> &mut SpecialFields
Source§fn new() -> UAttributes
fn new() -> UAttributes
Source§fn default_instance() -> &'static UAttributes
fn default_instance() -> &'static UAttributes
Source§fn parse_from(is: &mut CodedInputStream<'_>) -> Result<Self, Error>
fn parse_from(is: &mut CodedInputStream<'_>) -> Result<Self, Error>
Source§fn cached_size(&self) -> u32
fn cached_size(&self) -> u32
compute_size. Read moreSource§fn write_to(&self, os: &mut CodedOutputStream<'_>) -> Result<(), Error>
fn write_to(&self, os: &mut CodedOutputStream<'_>) -> Result<(), Error>
Source§fn write_length_delimited_to(
&self,
os: &mut CodedOutputStream<'_>,
) -> Result<(), Error>
fn write_length_delimited_to( &self, os: &mut CodedOutputStream<'_>, ) -> Result<(), Error>
Source§fn write_length_delimited_to_vec(&self, vec: &mut Vec<u8>) -> Result<(), Error>
fn write_length_delimited_to_vec(&self, vec: &mut Vec<u8>) -> Result<(), Error>
Source§fn merge_from_bytes(&mut self, bytes: &[u8]) -> Result<(), Error>
fn merge_from_bytes(&mut self, bytes: &[u8]) -> Result<(), Error>
Source§fn parse_from_reader(reader: &mut dyn Read) -> Result<Self, Error>
fn parse_from_reader(reader: &mut dyn Read) -> Result<Self, Error>
Source§fn parse_from_tokio_bytes(bytes: &Bytes) -> Result<Self, Error>
fn parse_from_tokio_bytes(bytes: &Bytes) -> Result<Self, Error>
Bytes object.
Resulting message may share references to the passed bytes object.Source§fn check_initialized(&self) -> Result<(), Error>
fn check_initialized(&self) -> Result<(), Error>
Source§fn write_to_writer(&self, w: &mut dyn Write) -> Result<(), Error>
fn write_to_writer(&self, w: &mut dyn Write) -> Result<(), Error>
Source§fn write_length_delimited_to_writer(
&self,
w: &mut dyn Write,
) -> Result<(), Error>
fn write_length_delimited_to_writer( &self, w: &mut dyn Write, ) -> Result<(), Error>
Source§fn write_length_delimited_to_bytes(&self) -> Result<Vec<u8>, Error>
fn write_length_delimited_to_bytes(&self) -> Result<Vec<u8>, Error>
Source§fn unknown_fields(&self) -> &UnknownFields
fn unknown_fields(&self) -> &UnknownFields
Source§fn mut_unknown_fields(&mut self) -> &mut UnknownFields
fn mut_unknown_fields(&mut self) -> &mut UnknownFields
Source§impl MessageFull for UAttributes
impl MessageFull for UAttributes
Source§fn descriptor() -> MessageDescriptor
fn descriptor() -> MessageDescriptor
Source§fn reflect_eq(&self, other: &Self, mode: &ReflectEqMode) -> bool
fn reflect_eq(&self, other: &Self, mode: &ReflectEqMode) -> bool
Source§impl PartialEq for UAttributes
impl PartialEq for UAttributes
Source§impl ProtobufValue for UAttributes
impl ProtobufValue for UAttributes
Source§type RuntimeType = RuntimeTypeMessage<UAttributes>
type RuntimeType = RuntimeTypeMessage<UAttributes>
impl StructuralPartialEq for UAttributes
Auto Trait Implementations§
impl !Freeze for UAttributes
impl RefUnwindSafe for UAttributes
impl Send for UAttributes
impl Sync for UAttributes
impl Unpin for UAttributes
impl UnwindSafe for UAttributes
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<M> MessageDyn for Mwhere
M: MessageFull,
impl<M> MessageDyn for Mwhere
M: MessageFull,
Source§fn descriptor_dyn(&self) -> MessageDescriptor
fn descriptor_dyn(&self) -> MessageDescriptor
Source§fn merge_from_dyn(&mut self, is: &mut CodedInputStream<'_>) -> Result<(), Error>
fn merge_from_dyn(&mut self, is: &mut CodedInputStream<'_>) -> Result<(), Error>
Source§fn write_to_with_cached_sizes_dyn(
&self,
os: &mut CodedOutputStream<'_>,
) -> Result<(), Error>
fn write_to_with_cached_sizes_dyn( &self, os: &mut CodedOutputStream<'_>, ) -> Result<(), Error>
Source§fn compute_size_dyn(&self) -> u64
fn compute_size_dyn(&self) -> u64
Source§fn is_initialized_dyn(&self) -> bool
fn is_initialized_dyn(&self) -> bool
true for protobuf 3.