Skip to main content

scratch_test_value/
constants.rs

1use crate::{SNumber, SValue};
2
3impl SValue {
4    /// For empty wholes in the shape of a comparison block,
5    /// Scratch automatically treats its value as `false`
6    pub const fn default_empty_cmp_hole() -> Self {
7        Self::Bool(false)
8    }
9    /// For empty wholes in the shape of an expression block,
10    /// Scratch automatically treats its value as the empty string
11    pub fn default_empty_expr_hole() -> Self {
12        Self::Text("".into())
13    }
14}
15
16#[allow(unused)]
17impl SValue {
18    pub(crate) const NAN: Self = Self::Float(f64::NAN);
19    pub(crate) const INFINITY: Self = Self::Float(f64::INFINITY);
20    pub(crate) const NEG_INFINITY: Self = Self::Float(f64::NEG_INFINITY);
21    pub(crate) const POS_ZERO: Self = Self::Float(0.0);
22    pub(crate) const NEG_ZERO: Self = Self::Float(-0.0);
23}
24
25#[allow(unused)]
26impl SNumber {
27    pub(crate) const NAN: Self = Self::Float(f64::NAN);
28    pub(crate) const INFINITY: Self = Self::Float(f64::INFINITY);
29    pub(crate) const NEG_INFINITY: Self = Self::Float(f64::NEG_INFINITY);
30    pub(crate) const POS_ZERO: Self = Self::Float(0.0);
31    pub(crate) const NEG_ZERO: Self = Self::Float(-0.0);
32}