pub enum Js {
Undefined,
Null,
Bool(bool),
Num(f64),
Str(String),
Arr(Vec<Js>),
Obj(Obj),
Typed(Typed, Arc<Vec<u8>>),
Blob(String, Arc<Vec<u8>>),
}Expand description
A JavaScript value as a row holds it.
Variants§
Undefined
undefined: left out of an object, null in an array (as JSON.stringify does).
Null
Bool(bool)
Num(f64)
Str(String)
Arr(Vec<Js>)
Obj(Obj)
Typed(Typed, Arc<Vec<u8>>)
A typed array, as its little-endian bytes.
Blob(String, Arc<Vec<u8>>)
A Blob of the given media type.
Implementations§
Source§impl Js
impl Js
pub fn num(&self) -> f64
pub fn as_str(&self) -> Option<&str>
pub fn as_obj(&self) -> Option<&Obj>
pub fn as_obj_mut(&mut self) -> Option<&mut Obj>
pub fn as_arr(&self) -> Option<&[Js]>
pub fn typed(kind: Typed, bytes: Vec<u8>) -> Js
pub fn u8s(bytes: Vec<u8>) -> Js
pub fn u32s(values: &[u32]) -> Js
pub fn f32s(values: &[f32]) -> Js
pub fn png(bytes: Vec<u8>) -> Js
Trait Implementations§
impl StructuralPartialEq for Js
Auto Trait Implementations§
impl Freeze for Js
impl RefUnwindSafe for Js
impl Send for Js
impl Sync for Js
impl Unpin for Js
impl UnsafeUnpin for Js
impl UnwindSafe for Js
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more