#[non_exhaustive]pub struct Label {
pub span: Span,
pub source: LitSource,
}
Expand description
A label, like 'foo
.
Custom labels are constructed in macros using MacroContext::label.
Examples
Constructing a label:
use rune::ast;
use rune::macros::MacroContext;
MacroContext::test(|ctx| {
let lit = ctx.label("foo");
assert!(matches!(lit, ast::Label { .. }))
});
Example labels:
use rune::{ast, testing};
testing::roundtrip::<ast::Label>("'foo");
testing::roundtrip::<ast::Label>("'barify42");
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.span: Span
The token of the label.
source: LitSource
The source of the label.
Trait Implementations§
source§impl PartialEq<Label> for Label
impl PartialEq<Label> for Label
source§impl<'a> Resolve<'a> for Label
impl<'a> Resolve<'a> for Label
source§fn resolve(&self, ctx: ResolveContext<'a>) -> Result<&'a str, ResolveError>
fn resolve(&self, ctx: ResolveContext<'a>) -> Result<&'a str, ResolveError>
Resolve the value from parsed AST.
source§impl ToTokens for Label
impl ToTokens for Label
source§fn to_tokens(&self, _: &mut MacroContext<'_>, stream: &mut TokenStream)
fn to_tokens(&self, _: &mut MacroContext<'_>, stream: &mut TokenStream)
Turn the current item into tokens.
impl Copy for Label
impl Eq for Label
impl StructuralEq for Label
impl StructuralPartialEq for Label
Auto Trait Implementations§
impl RefUnwindSafe for Label
impl Send for Label
impl Sync for Label
impl Unpin for Label
impl UnwindSafe for Label
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