pub enum UPriority {
UPRIORITY_UNSPECIFIED = 0,
UPRIORITY_CS0 = 1,
UPRIORITY_CS1 = 2,
UPRIORITY_CS2 = 3,
UPRIORITY_CS3 = 4,
UPRIORITY_CS4 = 5,
UPRIORITY_CS5 = 6,
UPRIORITY_CS6 = 7,
}
Variants§
UPRIORITY_UNSPECIFIED = 0
UPRIORITY_CS0 = 1
UPRIORITY_CS1 = 2
UPRIORITY_CS2 = 3
UPRIORITY_CS3 = 4
UPRIORITY_CS4 = 5
UPRIORITY_CS5 = 6
UPRIORITY_CS6 = 7
Implementations§
Source§impl UPriority
impl UPriority
Sourcepub fn to_priority_code(self) -> String
pub fn to_priority_code(self) -> String
Encodes this priority to a string.
The encoding of priorities to strings is defined in the uProtocol Core API.
§Examples
use up_rust::UPriority;
assert_eq!(UPriority::UPRIORITY_CS2.to_priority_code(), "CS2");
Sourcepub fn try_from_priority_code<T>(code: T) -> Result<Self, UAttributesError>
pub fn try_from_priority_code<T>(code: T) -> Result<Self, UAttributesError>
Gets the priority for a string.
The encoding of priorities to strings is defined in the uProtocol Core API.
§Errors
Returns an error if the given string does not match a supported priority.
§Examples
use up_rust::UPriority;
let priority = UPriority::try_from_priority_code("CS2").unwrap();
assert_eq!(priority, UPriority::UPRIORITY_CS2);
assert!(UPriority::try_from_priority_code("not-supported").is_err());
Trait Implementations§
Source§impl Enum for UPriority
impl Enum for UPriority
Source§impl EnumFull for UPriority
impl EnumFull for UPriority
Source§fn enum_descriptor() -> EnumDescriptor
fn enum_descriptor() -> EnumDescriptor
Get enum descriptor by type.
Source§fn descriptor(&self) -> EnumValueDescriptor
fn descriptor(&self) -> EnumValueDescriptor
Get enum value descriptor.
impl Copy for UPriority
impl Eq for UPriority
impl StructuralPartialEq for UPriority
Auto Trait Implementations§
impl Freeze for UPriority
impl RefUnwindSafe for UPriority
impl Send for UPriority
impl Sync for UPriority
impl Unpin for UPriority
impl UnwindSafe for UPriority
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