Expression

Enum Expression 

Source
pub enum Expression<'a> {
Show 15 variants Null, Int(i64), Float(f64), String(Cow<'a, str>), Bool(bool), Object(BTreeMap<Cow<'a, str>, Expression<'a>>), Array(Box<[Expression<'a>]>), Error(Box<Error<'a>>), Date(f64), Bytes(Cow<'a, str>), BigInt(Cow<'a, str>), Undefined, Import { id: Id, operation: Option<ImportOperation<'a>>, resolution: Resolution, }, Remap(Box<Remap<'a>>), Export { id: Id, resolution: Resolution, },
}
Expand description

The main expression type, representing values and references

Variants§

§

Null

JSON null

§

Int(i64)

A 64-bit signed integer

§

Float(f64)

A 64-bit floating point number

§

String(Cow<'a, str>)

A UTF-8 string

§

Bool(bool)

A boolean

§

Object(BTreeMap<Cow<'a, str>, Expression<'a>>)

A JSON object, with Expression values

§

Array(Box<[Expression<'a>]>)

A JSON array, with Expression values

§

Error(Box<Error<'a>>)

A Javascript Error value

§

Date(f64)

A JavaScript Date value, represented as a number of milliseconds since the Unix epoch

§

Bytes(Cow<'a, str>)

A byte array, encoded as a base64 string

§

BigInt(Cow<'a, str>)

A BigInt value, encoded as a string

§

Undefined

The JavaScript undefined value

§

Import

Reference an imported value, possibly performing actions on it

Fields

§id: Id

The ID of the import being referenced

§operation: Option<ImportOperation<'a>>

An optional operation to perform on the import

§resolution: Resolution

The type of resolution (promise or stub)

§

Remap(Box<Remap<'a>>)

A map() operation on an import

§

Export

The sender is exporting a new stub (or re-exporting a stub that was exported before)

The expression evaluates to a stub or promise

If this resolves to a promise, the id should always be a newly allocated ID, and The sender will proactively send a “resolve” (or “reject”) message for this ID when the promise resolves (unless it is released first). The recipient does not need to “pull” the promise explicitly; it is assumed that the recipient always wants the resolution.

Fields

§id: Id

The ID of the export

§resolution: Resolution

The type of resolution (promise or stub)

Trait Implementations§

Source§

impl<'a> Debug for Expression<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Expression<'de>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Expression<'_>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Expression<'a>

§

impl<'a> RefUnwindSafe for Expression<'a>

§

impl<'a> Send for Expression<'a>

§

impl<'a> Sync for Expression<'a>

§

impl<'a> Unpin for Expression<'a>

§

impl<'a> UnwindSafe for Expression<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.