pub enum HotLiteral {
Fmted(HotReloadFormattedSegment),
Float(LitFloat),
Int(LitInt),
Bool(LitBool),
}
Expand description
A literal value in the rsx! macro
These get hotreloading super powers, making them a bit more complex than a normal literal. In debug mode we need to generate a bunch of extra code to support hotreloading.
Eventually we want to remove this notion of hot literals since we’re generating different code in debug than in release, which is harder to maintain and can lead to bugs.
Variants§
Fmted(HotReloadFormattedSegment)
A formatted string literal We know this will generate a String, not an &’static str
The raw str type will generate a &’static str, but we need to distinguish the two for component props
“hello {world}”
Float(LitFloat)
A float literal
1.0
Int(LitInt)
An int literal
1
Bool(LitBool)
A bool literal
true
Implementations§
Source§impl HotLiteral
impl HotLiteral
pub fn quote_as_hot_reload_literal(&self) -> TokenStream2
Source§impl HotLiteral
impl HotLiteral
pub fn peek(input: ParseStream<'_>) -> bool
pub fn is_static(&self) -> bool
pub fn from_raw_text(text: &str) -> Self
Trait Implementations§
Source§impl Clone for HotLiteral
impl Clone for HotLiteral
Source§fn clone(&self) -> HotLiteral
fn clone(&self) -> HotLiteral
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 HotLiteral
impl Debug for HotLiteral
Source§impl Display for HotLiteral
impl Display for HotLiteral
Source§impl Hash for HotLiteral
impl Hash for HotLiteral
Source§impl Parse for HotLiteral
impl Parse for HotLiteral
fn parse(input: ParseStream<'_>) -> Result<Self>
Source§impl PartialEq for HotLiteral
impl PartialEq for HotLiteral
Source§impl ToTokens for HotLiteral
impl ToTokens for HotLiteral
Source§fn to_tokens(&self, out: &mut TokenStream)
fn to_tokens(&self, out: &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 HotLiteral
impl StructuralPartialEq for HotLiteral
Auto Trait Implementations§
impl Freeze for HotLiteral
impl !RefUnwindSafe for HotLiteral
impl !Send for HotLiteral
impl !Sync for HotLiteral
impl Unpin for HotLiteral
impl UnwindSafe for HotLiteral
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.