pub enum Value {
}
Expand description
Wraps different primitive variants used as values in html This is needed since html attributes can have different value types such as checked(bool), name(String), tab_index(i32) Note: memory size of Value is 32 bytes, in comparison String is 24 bytes
Variants§
Bool(bool)
bool value
Cow(Cow<'static, str>)
String value and &’static str
Vec(Vec<Value>)
a vec of values
U8(u8)
u8 value
U16(u16)
u16 value
U32(u32)
u32 value
U64(u64)
u64 value
Usize(usize)
usize value
U128(u128)
u128 value
I8(i8)
i8 value
I16(i16)
i16 value
I32(i32)
i32 value
I64(i64)
i64 value
I128(i128)
i128 value
Isize(isize)
isize value
F32(f32)
f32 value
F64(f64)
f64 value
Implementations§
source§impl Value
impl Value
sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
returns an &str reference if this value is Str
or String
variant
Note: This doesn’t convert other variant into str representation
Use the to_string()
for that.
sourcepub fn as_f32(&self) -> Option<f32>
pub fn as_f32(&self) -> Option<f32>
converts to f32 if the variants are numerical representation
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
converts to f64 if the variants are numerical representation
sourcepub fn as_i32(&self) -> Option<i32>
pub fn as_i32(&self) -> Option<i32>
converts to i32 if the variants are numerical representation
Trait Implementations§
source§impl<V0, V1, V2> From<(V0, V1, V2)> for Value
impl<V0, V1, V2> From<(V0, V1, V2)> for Value
source§fn from(values: (V0, V1, V2)) -> Value
fn from(values: (V0, V1, V2)) -> Value
source§impl<V0, V1, V2, V3> From<(V0, V1, V2, V3)> for Value
impl<V0, V1, V2, V3> From<(V0, V1, V2, V3)> for Value
source§fn from(values: (V0, V1, V2, V3)) -> Value
fn from(values: (V0, V1, V2, V3)) -> Value
source§impl<V0, V1, V2, V3, V4> From<(V0, V1, V2, V3, V4)> for Value
impl<V0, V1, V2, V3, V4> From<(V0, V1, V2, V3, V4)> for Value
source§fn from(values: (V0, V1, V2, V3, V4)) -> Value
fn from(values: (V0, V1, V2, V3, V4)) -> Value
source§impl PartialEq for Value
impl PartialEq for Value
impl Eq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.