Struct fluent_syntax::ast::NamedArgument
source · pub struct NamedArgument<S> {
pub name: Identifier<S>,
pub value: InlineExpression<S>,
}
Expand description
A key-value pair used in CallArguments
.
§Example
use fluent_syntax::parser;
use fluent_syntax::ast;
let ftl = r#"
key = { FUNC(style: "long") }
"#;
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: "key"
},
value: Some(ast::Pattern {
elements: vec![
ast::PatternElement::Placeable {
expression: ast::Expression::Inline(
ast::InlineExpression::FunctionReference {
id: ast::Identifier {
name: "FUNC"
},
arguments: ast::CallArguments {
positional: vec![],
named: vec![
ast::NamedArgument {
name: ast::Identifier {
name: "style"
},
value: ast::InlineExpression::StringLiteral
{
value: "long"
}
}
],
}
}
)
},
]
}),
attributes: vec![],
comment: None,
}
)
]
}
);
Fields§
§name: Identifier<S>
§value: InlineExpression<S>
Trait Implementations§
source§impl<S: Clone> Clone for NamedArgument<S>
impl<S: Clone> Clone for NamedArgument<S>
source§fn clone(&self) -> NamedArgument<S>
fn clone(&self) -> NamedArgument<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 NamedArgument<S>
impl<S: Debug> Debug for NamedArgument<S>
source§impl<S: PartialEq> PartialEq for NamedArgument<S>
impl<S: PartialEq> PartialEq for NamedArgument<S>
source§fn eq(&self, other: &NamedArgument<S>) -> bool
fn eq(&self, other: &NamedArgument<S>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<S> StructuralPartialEq for NamedArgument<S>
Auto Trait Implementations§
impl<S> Freeze for NamedArgument<S>where
S: Freeze,
impl<S> RefUnwindSafe for NamedArgument<S>where
S: RefUnwindSafe,
impl<S> Send for NamedArgument<S>where
S: Send,
impl<S> Sync for NamedArgument<S>where
S: Sync,
impl<S> Unpin for NamedArgument<S>where
S: Unpin,
impl<S> UnwindSafe for NamedArgument<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