Struct fluent_syntax::ast::Identifier
source · pub struct Identifier<S> {
pub name: S,
}
Expand description
Identifier is part of nodes such as Message
, Term
and Attribute
.
It is used to associate a unique key with an Entry
or an Attribute
and in Expression
nodes to refer to another entry.
§Example
use fluent_syntax::parser;
use fluent_syntax::ast;
let ftl = r#"
hello-world = Value
"#;
let resource = parser::parse(ftl)
.expect("Failed to parse an FTL resource.");
assert_eq!(
resource,
ast::Resource {
body: vec![
ast::Entry::Message(ast::Message {
id: ast::Identifier {
name: "hello-world"
},
value: Some(ast::Pattern {
elements: vec![
ast::PatternElement::TextElement {
value: "Value"
}
]
}),
attributes: vec![],
comment: None,
}),
]
}
);
Fields§
§name: S
Trait Implementations§
source§impl<S: Clone> Clone for Identifier<S>
impl<S: Clone> Clone for Identifier<S>
source§fn clone(&self) -> Identifier<S>
fn clone(&self) -> Identifier<S>
Returns a copy 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<S: Debug> Debug for Identifier<S>
impl<S: Debug> Debug for Identifier<S>
source§impl<S: PartialEq> PartialEq for Identifier<S>
impl<S: PartialEq> PartialEq for Identifier<S>
source§fn eq(&self, other: &Identifier<S>) -> bool
fn eq(&self, other: &Identifier<S>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<S: Eq> Eq for Identifier<S>
impl<S> StructuralPartialEq for Identifier<S>
Auto Trait Implementations§
impl<S> Freeze for Identifier<S>where
S: Freeze,
impl<S> RefUnwindSafe for Identifier<S>where
S: RefUnwindSafe,
impl<S> Send for Identifier<S>where
S: Send,
impl<S> Sync for Identifier<S>where
S: Sync,
impl<S> Unpin for Identifier<S>where
S: Unpin,
impl<S> UnwindSafe for Identifier<S>where
S: UnwindSafe,
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