pub enum Value {
Undefined,
Null,
Bool(bool),
Number(f64),
String(Rc<[u16]>),
Object(Rc<RefCell<Object>>),
}Variants§
Implementations§
Source§impl Value
impl Value
pub fn string(text: impl AsRef<str>) -> Self
pub fn object(kind: impl Into<String>) -> Self
pub fn number(number: impl Into<f64>) -> Self
pub fn array(items: Vec<Value>) -> Self
pub fn native(name: impl Into<String>) -> Self
pub fn promise(result: Result<Value>) -> Self
pub fn pending_promise() -> Self
pub fn error(name: impl AsRef<str>, message: impl AsRef<str>) -> Self
pub fn as_object(&self) -> Option<Rc<RefCell<Object>>>
pub fn kind(&self) -> String
pub fn get(&self, key: &str) -> Value
pub fn put(&self, key: &str, value: Value)
Store implementation-owned metadata without exposing it to enumeration.
pub fn items(&self) -> Vec<Value>
pub fn node_id(&self) -> Option<NodeId>
pub fn same(&self, other: &Value) -> bool
pub fn truthy(&self) -> bool
pub fn number_value(&self) -> f64
pub fn text(&self) -> String
pub fn from_json(value: Value) -> Value
pub fn to_json(&self) -> Result<Value>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl !UnwindSafe for Value
impl Forget for Value
impl Freeze for Value
impl Move for Value
impl Unpin for Value
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert