pub struct Purpose { /* private fields */ }Expand description
Implementations§
Source§impl Purpose
impl Purpose
Sourcepub fn parser(input: &mut &str) -> ModalResult<Self>
pub fn parser(input: &mut &str) -> ModalResult<Self>
Recognizes a Purpose in a string slice.
§Errors
§Examples
use voa_core::identifiers::{Mode, Purpose, Role};
use winnow::Parser;
assert_eq!(
Purpose::parser.parse("trust-anchor-test")?,
Purpose::new(Role::Custom("test".parse()?), Mode::TrustAnchor),
);
assert_eq!(
Purpose::parser.parse("test")?,
Purpose::new(Role::Custom("test".parse()?), Mode::ArtifactVerifier),
);Sourcepub fn purpose_to_string(&self) -> String
pub fn purpose_to_string(&self) -> String
A String representation of this Purpose specifier.
This function produces the exact representation specified in https://uapi-group.org/specifications/specs/file_hierarchy_for_the_verification_of_os_artifacts/#purpose
Sourcepub fn is_trust_anchor(&self) -> bool
pub fn is_trust_anchor(&self) -> bool
Checks whether self uses Mode::TrustAnchor.
Returns true if self uses Mode::TrustAnchor, false otherwise.
Sourcepub fn to_trust_anchor(self) -> Self
pub fn to_trust_anchor(self) -> Self
Consumes self and returns a Purpose which uses Mode::TrustAnchor.
Trait Implementations§
Source§impl Ord for Purpose
impl Ord for Purpose
Source§impl PartialOrd for Purpose
impl PartialOrd for Purpose
impl Eq for Purpose
impl StructuralPartialEq for Purpose
Auto Trait Implementations§
impl Freeze for Purpose
impl RefUnwindSafe for Purpose
impl Send for Purpose
impl Sync for Purpose
impl Unpin for Purpose
impl UnwindSafe for Purpose
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