pub struct KeyedAttribute {
pub key: NodeName,
pub possible_value: KeyedAttributeValue,
}Expand description
Element attribute with fixed key.
Example: key=value // attribute with ident as value key // attribute without value
Fields§
§key: NodeNameKey of the element attribute.
possible_value: KeyedAttributeValueValue of the element attribute.
Implementations§
Source§impl KeyedAttribute
impl KeyedAttribute
Sourcepub fn value_literal_string(&self) -> Option<String>
pub fn value_literal_string(&self) -> Option<String>
Returns string representation of inner value, if value expression contain something that can be treated as displayable literal.
Example of displayable literals:
"string" // string
'c' // char
0x12, 1231 // integer - converted to decimal form
0.12 // float point value - converted to decimal form
true, false // booleans
Examples of literals that also will be non-displayable:
b'a' // byte
b"asdad" // byte-string
Examples of non-static non-displayable expressions:
{ x + 1} // block of code
y // usage of variable
|v| v + 1 // closure is valid expression too
[1, 2, 3] // arrays,
for/while/if // any controll flow
.. and this list can be extended
Adapted from leptos
pub fn value(&self) -> Option<&Expr>
Trait Implementations§
Source§impl Clone for KeyedAttribute
impl Clone for KeyedAttribute
Source§fn clone(&self) -> KeyedAttribute
fn clone(&self) -> KeyedAttribute
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KeyedAttribute
impl Debug for KeyedAttribute
Source§impl ParseRecoverable for KeyedAttribute
impl ParseRecoverable for KeyedAttribute
fn parse_recoverable( parser: &mut RecoverableContext, input: ParseStream<'_>, ) -> Option<Self>
Source§impl ToTokens for KeyedAttribute
impl ToTokens for KeyedAttribute
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for KeyedAttribute
impl RefUnwindSafe for KeyedAttribute
impl !Send for KeyedAttribute
impl !Sync for KeyedAttribute
impl Unpin for KeyedAttribute
impl UnwindSafe for KeyedAttribute
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.