pub enum Context {
Default,
Custom(CustomContext),
}Expand description
A context within a Purpose for more fine-grained verifier
assignments.
An example for context is the name of a specific software repository when certificates are used in the context of the packages purpose (e.g. “core”).
If no specific context is required, Context::Default must be used.
Variants§
Implementations§
Source§impl Context
impl Context
Sourcepub(crate) fn path_segment(&self) -> PathBuf
pub(crate) fn path_segment(&self) -> PathBuf
Returns the path segment for this context.
Sourcepub fn parser(input: &mut &str) -> ModalResult<Self>
pub fn parser(input: &mut &str) -> ModalResult<Self>
Recognizes a Context in a string slice.
Consumes all of its input.
§Errors
Returns an error if
inputdoes not contain a variant ofContext,- or one of the characters in
inputis not covered byIdentifierString::valid_chars.
§Examples
use voa_core::identifiers::{Context, CustomContext};
use winnow::Parser;
assert_eq!(Context::parser.parse("default")?, Context::Default);
assert_eq!(
Context::parser.parse("test")?,
Context::Custom(CustomContext::new("test".parse()?))
);Trait Implementations§
Source§impl From<CustomContext> for Context
impl From<CustomContext> for Context
Source§fn from(val: CustomContext) -> Self
fn from(val: CustomContext) -> Self
Converts to this type from the input type.
impl Eq for Context
impl StructuralPartialEq for Context
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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