pub struct Purpose {
role: Role,
mode: Mode,
}
Expand description
Fields§
§role: Role
§mode: Mode
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),
);
Sourcefn purpose_to_string(&self) -> String
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(crate) fn path_segment(&self) -> PathBuf
pub(crate) fn path_segment(&self) -> PathBuf
Returns the path segment for this Purpose
Trait Implementations§
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