pub enum Value {
Undefined,
Null,
Bool(bool),
Int(i64),
Float(f64),
String(String, TaintLabel),
Json(String, TaintLabel),
Bytes(Vec<u8>),
}Expand description
A loosely-typed value passed through the bridge.
Variants§
Undefined
Null
Bool(bool)
Int(i64)
Float(f64)
String(String, TaintLabel)
Json(String, TaintLabel)
JSON-encoded complex value (objects, arrays).
Bytes(Vec<u8>)
Raw bytes (ArrayBuffer, Uint8Array).
Implementations§
Source§impl Value
impl Value
pub fn string(value: impl Into<String>) -> Self
pub fn tainted_string(value: impl Into<String>, label: TaintLabel) -> Self
pub fn json(value: impl Into<String>) -> Self
pub fn tainted_json(value: impl Into<String>, label: TaintLabel) -> Self
pub fn is_nullish(&self) -> bool
pub fn as_str(&self) -> Option<&str>
pub fn as_bool(&self) -> Option<bool>
pub fn taint_label(&self) -> TaintLabel
pub fn is_tainted(&self) -> bool
pub fn with_taint(self, label: TaintLabel) -> Self
pub fn concat(&self, other: &Self) -> Option<Self>
pub fn slice(&self, start: usize, end: usize) -> Option<Self>
pub fn replace(&self, from: &str, to: &str) -> Option<Self>
pub fn check_taint_at_sink(sink: &str, args: &[Self]) -> Option<TaintFlow>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin 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
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