pub enum AttributeValue {
Shorthand(Ident),
AttrLiteral(HotLiteral),
EventTokens(PartialClosure),
IfExpr(IfAttributeValue),
AttrExpr(PartialExpr),
}
Variants§
Shorthand(Ident)
Just a regular shorthand attribute - an ident. Makes our parsing a bit more opaque. attribute,
AttrLiteral(HotLiteral)
Any attribute that’s a literal. These get hotreloading super powers
attribute: “value” attribute: bool, attribute: 1,
EventTokens(PartialClosure)
A series of tokens that represent an event handler
We use a special type here so we can get autocomplete in the closure using partial expansion. We also do some extra wrapping for improved type hinting since rust sometimes has trouble with generics and closures.
IfExpr(IfAttributeValue)
Conditional expression
attribute: if bool { “value” } else if bool { “other value” } else { “default value” }
Currently these don’t get hotreloading super powers, but they could, depending on how far we want to go with it
AttrExpr(PartialExpr)
attribute: some_expr attribute: {some_expr} ?
Implementations§
Trait Implementations§
Source§impl Clone for AttributeValue
impl Clone for AttributeValue
Source§fn clone(&self) -> AttributeValue
fn clone(&self) -> AttributeValue
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 Debug for AttributeValue
impl Debug for AttributeValue
Source§impl Hash for AttributeValue
impl Hash for AttributeValue
Source§impl Parse for AttributeValue
impl Parse for AttributeValue
fn parse(content: ParseStream<'_>) -> Result<Self>
Source§impl PartialEq for AttributeValue
impl PartialEq for AttributeValue
Source§impl ToTokens for AttributeValue
impl ToTokens for AttributeValue
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,
impl Eq for AttributeValue
impl StructuralPartialEq for AttributeValue
Auto Trait Implementations§
impl Freeze for AttributeValue
impl !RefUnwindSafe for AttributeValue
impl !Send for AttributeValue
impl !Sync for AttributeValue
impl Unpin for AttributeValue
impl UnwindSafe for AttributeValue
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
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
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.