pub struct Percent<S = (), C = (), Lang: ?Sized = ()> { /* private fields */ }Expand description
The % punctuator
Implementations§
Source§impl Percent
impl Percent
Sourcepub fn try_parse<'inp, L, Ctx, Lang: ?Sized, Cmpl>(
inp: &mut InputRef<'inp, '_, L, Ctx, Lang, Cmpl>,
) -> Result<ParseAttempt<Percent<L::Span, (), Lang>>, <Ctx::Emitter as Emitter<'inp, L, Lang>>::Error>where
L: Lexer<'inp>,
L::Token: PunctuatorToken<'inp>,
Ctx: ParseContext<'inp, L, Lang>,
Cmpl: SurfaceIncomplete<'inp, L, Ctx, Lang>,
<Ctx::Emitter as Emitter<'inp, L, Lang>>::Error: From<UnexpectedEot<L::Offset, Lang>>,
Available on crate feature punct only.
pub fn try_parse<'inp, L, Ctx, Lang: ?Sized, Cmpl>(
inp: &mut InputRef<'inp, '_, L, Ctx, Lang, Cmpl>,
) -> Result<ParseAttempt<Percent<L::Span, (), Lang>>, <Ctx::Emitter as Emitter<'inp, L, Lang>>::Error>where
L: Lexer<'inp>,
L::Token: PunctuatorToken<'inp>,
Ctx: ParseContext<'inp, L, Lang>,
Cmpl: SurfaceIncomplete<'inp, L, Ctx, Lang>,
<Ctx::Emitter as Emitter<'inp, L, Lang>>::Error: From<UnexpectedEot<L::Offset, Lang>>,
punct only.A parser that parses a token and returns a Percent instance if it matches.
If the function returns Ok(ParseAttempt::Decline), it means the next token does not match,
and promises no valid token is consumed; a terminal scanner stop is an error, never a
Decline.
Lang is read off the input, so an unbranded grammar writes the same call as a
branded one.
Sourcepub fn parse<'inp, L, Ctx, Lang, Cmpl>(
inp: &mut InputRef<'inp, '_, L, Ctx, Lang, Cmpl>,
) -> Result<Percent<L::Span, (), Lang>, <Ctx::Emitter as Emitter<'inp, L, Lang>>::Error>where
L: Lexer<'inp>,
L::Token: PunctuatorToken<'inp>,
Ctx: ParseContext<'inp, L, Lang>,
Cmpl: SurfaceIncomplete<'inp, L, Ctx, Lang>,
<Ctx::Emitter as Emitter<'inp, L, Lang>>::Error: From<UnexpectedEot<L::Offset, Lang>> + From<UnexpectedToken<'inp, L::Token, <L::Token as Token<'inp>>::Kind, L::Span, Lang>>,
Lang: ?Sized,
Available on crate feature punct only.
pub fn parse<'inp, L, Ctx, Lang, Cmpl>(
inp: &mut InputRef<'inp, '_, L, Ctx, Lang, Cmpl>,
) -> Result<Percent<L::Span, (), Lang>, <Ctx::Emitter as Emitter<'inp, L, Lang>>::Error>where
L: Lexer<'inp>,
L::Token: PunctuatorToken<'inp>,
Ctx: ParseContext<'inp, L, Lang>,
Cmpl: SurfaceIncomplete<'inp, L, Ctx, Lang>,
<Ctx::Emitter as Emitter<'inp, L, Lang>>::Error: From<UnexpectedEot<L::Offset, Lang>> + From<UnexpectedToken<'inp, L::Token, <L::Token as Token<'inp>>::Kind, L::Span, Lang>>,
Lang: ?Sized,
punct only.A parser that parses a token and returns a Percent instance if it matches.
Lang is read off the input, so an unbranded grammar writes the same call as a
branded one.
Source§impl<S, C> Percent<S, C>
impl<S, C> Percent<S, C>
Sourcepub const fn with_content(span: S, content: C) -> Self
pub const fn with_content(span: S, content: C) -> Self
Creates a new % punctuator with the given span and content.
Trait Implementations§
impl<S: Copy, C: Copy, Lang: Copy + ?Sized> Copy for Percent<S, C, Lang>
Source§impl<S, C, Lang: ?Sized> DisplayCompact for Percent<S, C, Lang>
impl<S, C, Lang: ?Sized> DisplayCompact for Percent<S, C, Lang>
Source§impl<S, C, Lang: ?Sized> DisplayHuman for Percent<S, C, Lang>
impl<S, C, Lang: ?Sized> DisplayHuman for Percent<S, C, Lang>
Source§impl<S, C, Lang: ?Sized> DisplayPretty for Percent<S, C, Lang>
impl<S, C, Lang: ?Sized> DisplayPretty for Percent<S, C, Lang>
impl<S: Eq, C: Eq, Lang: Eq + ?Sized> Eq for Percent<S, C, Lang>
Source§impl<S, C, Lang: ?Sized> IntoComponents for Percent<S, C, Lang>
impl<S, C, Lang: ?Sized> IntoComponents for Percent<S, C, Lang>
Source§type Components = (S, C)
type Components = (S, C)
The tuple or struct type containing the decomposed components. Read more
Source§fn into_components(self) -> Self::Components
fn into_components(self) -> Self::Components
Consumes this element and returns its constituent components. Read more
Source§impl<S, C, Lang: ?Sized> PartialOrd<Percent<S, C, Lang>> for str
impl<S, C, Lang: ?Sized> PartialOrd<Percent<S, C, Lang>> for str
Source§impl<S, C, Lang: ?Sized> PartialOrd<str> for Percent<S, C, Lang>
impl<S, C, Lang: ?Sized> PartialOrd<str> for Percent<S, C, Lang>
Source§impl<'inp, L, S, C, Lang: ?Sized> Punctuator<'inp, L, Lang> for Percent<S, C, Lang>
impl<'inp, L, S, C, Lang: ?Sized> Punctuator<'inp, L, Lang> for Percent<S, C, Lang>
impl<S: PartialEq, C: PartialEq, Lang: PartialEq + ?Sized> StructuralPartialEq for Percent<S, C, Lang>
Auto Trait Implementations§
impl<S, C, Lang> Freeze for Percent<S, C, Lang>
impl<S, C, Lang> RefUnwindSafe for Percent<S, C, Lang>
impl<S, C, Lang> Send for Percent<S, C, Lang>
impl<S, C, Lang> Sync for Percent<S, C, Lang>
impl<S, C, Lang> Unpin for Percent<S, C, Lang>
impl<S, C, Lang> UnsafeUnpin for Percent<S, C, Lang>
impl<S, C, Lang> UnwindSafe for Percent<S, C, Lang>
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