Enum JsValue
pub enum JsValue {
Undefined,
Null,
Bool(bool),
Number(f64),
String(JsStr),
Array(JsArray),
Object(JsObject),
}js and std only.Expand description
An engine-agnostic js value.
This is the type in which values cross the js boundary in both directions: script results, host function arguments and return values, and configured globals.
Function values cannot cross the boundary: a top-level function
result is a JsErrorKind::Conversion
error, and function properties are skipped when snapshotting objects
(mirroring JSON.stringify semantics).
Variants§
Undefined
undefined
Null
null
Bool(bool)
true / false
Number(f64)
any js number (always an f64, like in js itself)
String(JsStr)
a string value
Array(JsArray)
an array snapshot
Object(JsObject)
an object snapshot
Implementations§
§impl JsValue
impl JsValue
pub fn deserialize_into<T>(&self) -> Result<T, JsError>where
T: DeserializeOwned,
pub fn deserialize_into<T>(&self) -> Result<T, JsError>where
T: DeserializeOwned,
Deserialize this value into any serde-capable type.
§impl JsValue
impl JsValue
pub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Returns true if this value is undefined.
pub fn is_null_or_undefined(&self) -> bool
pub fn is_null_or_undefined(&self) -> bool
Returns true if this value is null or undefined.
Trait Implementations§
§impl<'de> Deserialize<'de> for JsValue
impl<'de> Deserialize<'de> for JsValue
§fn deserialize<D>(
deserializer: D,
) -> Result<JsValue, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<JsValue, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl From<&SocketAddr> for JsValue
impl From<&SocketAddr> for JsValue
§fn from(value: &SocketAddr) -> JsValue
fn from(value: &SocketAddr) -> JsValue
§impl From<&SocketAddress> for JsValue
impl From<&SocketAddress> for JsValue
§fn from(value: &SocketAddress) -> JsValue
fn from(value: &SocketAddress) -> JsValue
§impl From<SocketAddr> for JsValue
impl From<SocketAddr> for JsValue
§fn from(value: SocketAddr) -> JsValue
fn from(value: SocketAddr) -> JsValue
§impl From<SocketAddress> for JsValue
impl From<SocketAddress> for JsValue
§fn from(value: SocketAddress) -> JsValue
fn from(value: SocketAddress) -> JsValue
§impl PartialEq for JsValue
Values are compared structurally without recursing, so host-constructed
values of absurd depth cannot overflow the stack.
impl PartialEq for JsValue
Values are compared structurally without recursing, so host-constructed values of absurd depth cannot overflow the stack.
§impl Serialize for JsValue
impl Serialize for JsValue
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
§impl TryFrom<JsValue> for SocketAddr
impl TryFrom<JsValue> for SocketAddr
§impl TryFrom<JsValue> for SocketAddress
impl TryFrom<JsValue> for SocketAddress
Auto Trait Implementations§
impl Freeze for JsValue
impl RefUnwindSafe for JsValue
impl Send for JsValue
impl Sync for JsValue
impl Unpin for JsValue
impl UnsafeUnpin for JsValue
impl UnwindSafe for JsValue
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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§impl<T> IntoJsGlobal for T
impl<T> IntoJsGlobal for T
§fn into_global_entry(self) -> JsGlobal
fn into_global_entry(self) -> JsGlobal
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> JsFnOutput<ValueOutput> for T
impl<T> JsFnOutput<ValueOutput> for T
§fn into_js_fn_output(self) -> Result<JsValue, JsError>
fn into_js_fn_output(self) -> Result<JsValue, JsError>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.