Enum foundation_ur::UR
source · pub enum UR<'a> {
SinglePart {
ur_type: &'a str,
message: &'a str,
},
SinglePartDeserialized {
ur_type: &'a str,
message: &'a [u8],
},
MultiPart {
ur_type: &'a str,
fragment: &'a str,
sequence: u32,
sequence_count: u32,
},
MultiPartDeserialized {
ur_type: &'a str,
fragment: Part<'a>,
},
}
Expand description
An uniform resource.
Variants§
SinglePart
A single-part resource.
SinglePartDeserialized
A deserialized single-part resource.
MultiPart
A multiple-part resource.
Fields
MultiPartDeserialized
A deserialized multiple-part resource.
Implementations§
source§impl<'a> UR<'a>
impl<'a> UR<'a>
sourcepub fn parse(s: &'a str) -> Result<Self, ParseURError>
pub fn parse(s: &'a str) -> Result<Self, ParseURError>
Parses an uniform resource string.
Keep in mind, this does not deserialize the bytewords
payload,
deserialization is performed separately, for example, by the
decoder.
sourcepub fn is_single_part(&self) -> bool
pub fn is_single_part(&self) -> bool
Returns true if the Uniform Resource is single-part.
sourcepub fn is_multi_part(&self) -> bool
pub fn is_multi_part(&self) -> bool
Returns true
if the Uniform Resource is multi-part.
sourcepub fn is_deserialized(&self) -> bool
pub fn is_deserialized(&self) -> bool
Returns true
if this Uniform Resource is multi-part and deserialized.
sourcepub fn as_bytewords(&self) -> Option<&str>
pub fn as_bytewords(&self) -> Option<&str>
Returns Some(bytewords)
if the Uniform Resource is serialized.
sourcepub fn as_part(&self) -> Option<&Part<'_>>
pub fn as_part(&self) -> Option<&Part<'_>>
Returns Some(part)
if the Uniform Resource is multi-part and is
deserialized.
sourcepub fn sequence(&self) -> Option<u32>
pub fn sequence(&self) -> Option<u32>
Returns Some(n)
where n
is the sequence number if the Uniform
Resource is multi part.
sourcepub fn sequence_count(&self) -> Option<u32>
pub fn sequence_count(&self) -> Option<u32>
Returns Some(n)
where n
is the sequence count if the Uniform
Resource is multi part.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for UR<'a>
impl<'a> RefUnwindSafe for UR<'a>
impl<'a> Send for UR<'a>
impl<'a> Sync for UR<'a>
impl<'a> Unpin for UR<'a>
impl<'a> UnwindSafe for UR<'a>
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more