pub enum LiteralValue {
Bool(bool),
Int(i64),
Float(f64),
Char(char),
String(String),
}Expand description
The concrete value a TermPatternKind::Literal pattern tests for.
The pattern’s own tpe cannot tell 1 from 2, or 'a' from 'b': both share one
type, and only this says which value the scrutinee has to equal. A Float is equal
to a scrutinee as IEEE 754 compares them (What structural equality
computes),
so 0.0 equals -0.0. The compiler accepts no negative pattern literal, so no
pattern holds -0.0; no literal is nan, so a nan scrutinee equals none. A Bool is tested
by its value too: Basics’ own True/False constructors arrive here as a
Bool(..), never as a TermPatternKind::Constructor (typer::translate_pattern
does the normalising).
Variants§
Trait Implementations§
Source§impl Clone for LiteralValue
impl Clone for LiteralValue
Source§fn clone(&self) -> LiteralValue
fn clone(&self) -> LiteralValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 LiteralValue
impl Debug for LiteralValue
Source§impl PartialEq for LiteralValue
impl PartialEq for LiteralValue
impl StructuralPartialEq for LiteralValue
Auto Trait Implementations§
impl Freeze for LiteralValue
impl RefUnwindSafe for LiteralValue
impl Send for LiteralValue
impl Sync for LiteralValue
impl Unpin for LiteralValue
impl UnsafeUnpin for LiteralValue
impl UnwindSafe for LiteralValue
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