Struct fluent_syntax::ast::Identifier [−][src]
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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
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
Mutably borrows from an owned value. Read more