pub struct CustomContext(IdentifierString);
Expand description
A CustomContext
encodes a value for a Context
that is not Context::Default
.
Tuple Fields§
§0: IdentifierString
Implementations§
Source§impl CustomContext
impl CustomContext
Sourcepub fn new(value: IdentifierString) -> Self
pub fn new(value: IdentifierString) -> Self
Creates a new CustomContext
instance.
Sourcepub fn parser(input: &mut &str) -> ModalResult<Self>
pub fn parser(input: &mut &str) -> ModalResult<Self>
Recognizes a CustomContext
in a string slice.
Consumes all of its input
.
§Errors
Returns an error if one of the characters in input
is not covered by
IdentifierString::valid_chars
.
§Examples
use voa_core::identifiers::CustomContext;
use winnow::Parser;
assert_eq!(CustomContext::parser.parse("test")?.to_string(), "test");
Trait Implementations§
Source§impl AsRef<str> for CustomContext
impl AsRef<str> for CustomContext
Source§impl Clone for CustomContext
impl Clone for CustomContext
Source§fn clone(&self) -> CustomContext
fn clone(&self) -> CustomContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CustomContext
impl Debug for CustomContext
Source§impl Display for CustomContext
impl Display for CustomContext
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.
Source§impl FromStr for CustomContext
impl FromStr for CustomContext
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a CustomContext
from a string slice.
§Note
Delegates to CustomContext::parser
.
§Errors
Returns an error if CustomContext::parser
fails.
Source§impl PartialEq for CustomContext
impl PartialEq for CustomContext
Source§impl Serialize for CustomContext
impl Serialize for CustomContext
impl Eq for CustomContext
impl StructuralPartialEq for CustomContext
Auto Trait Implementations§
impl Freeze for CustomContext
impl RefUnwindSafe for CustomContext
impl Send for CustomContext
impl Sync for CustomContext
impl Unpin for CustomContext
impl UnwindSafe for CustomContext
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