Enum sauron_core::html::attributes::Value
source · 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)
Variants§
Bool(bool)
bool value
Str(&'static str)
&’static str value
String(String)
String value
Vec(Vec<Value, Global>)
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_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
converts to f64 if the variants are numerical representation
Trait Implementations§
source§impl<T, U, V, X> From<(T, U, V, X)> for Valuewhere
T: Into<Value>,
U: Into<Value>,
V: Into<Value>,
X: Into<Value>,
impl<T, U, V, X> From<(T, U, V, X)> for Valuewhere T: Into<Value>, U: Into<Value>, V: Into<Value>, X: Into<Value>,
source§fn from(v: (T, U, V, X)) -> Value
fn from(v: (T, U, V, X)) -> Value
Converts to this type from the input type.
source§impl<T, U, V, X, Z> From<(T, U, V, X, Z)> for Valuewhere
T: Into<Value>,
U: Into<Value>,
V: Into<Value>,
X: Into<Value>,
Z: Into<Value>,
impl<T, U, V, X, Z> From<(T, U, V, X, Z)> for Valuewhere T: Into<Value>, U: Into<Value>, V: Into<Value>, X: Into<Value>, Z: Into<Value>,
source§fn from(v: (T, U, V, X, Z)) -> Value
fn from(v: (T, U, V, X, Z)) -> Value
Converts to this type from the input type.
source§impl PartialEq<Value> for Value
impl PartialEq<Value> for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more