Skip to main content

Completion

Struct Completion 

Source
pub struct Completion {
    pub completion_type: CompletionType,
    pub value: Option<JsValue>,
    pub target: Option<String>,
}
Expand description

Completion record. Every statement evaluation returns a completion record.

Fields§

§completion_type: CompletionType

The type of completion.

§value: Option<JsValue>

The value, if any.

§target: Option<String>

Target label for break/continue.

Implementations§

Source§

impl Completion

Source

pub fn normal() -> Self

Create a normal completion with no value.

Source

pub fn normal_with_value(value: JsValue) -> Self

Create a normal completion with a value.

Source

pub fn return_value(value: JsValue) -> Self

Create a return completion.

Source

pub fn return_undefined() -> Self

Create a return completion with undefined.

Source

pub fn throw(error: JErrorType) -> Self

Create a throw completion (exception).

Source

pub fn break_completion(target: Option<String>) -> Self

Create a break completion.

Source

pub fn continue_completion(target: Option<String>) -> Self

Create a continue completion.

Source

pub fn yield_value(value: JsValue) -> Self

Create a yield completion with a value.

Source

pub fn is_normal(&self) -> bool

Check if this is a normal completion.

Source

pub fn is_abrupt(&self) -> bool

Check if this is an abrupt completion (not normal).

Source

pub fn get_value(&self) -> JsValue

Get the value, or undefined if none.

Source

pub fn update_empty(self, value: JsValue) -> Self

Update the value of a normal completion.

Auto Trait Implementations§

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.