Skip to main content

ObjectExt

Trait ObjectExt 

Source
pub trait ObjectExt<'js> {
    // Required methods
    fn get_optional<K: IntoAtom<'js> + Clone, V: FromJs<'js>>(
        &self,
        k: K,
    ) -> Result<Option<V>>;
    fn get_required<K: AsRef<str>, V: FromJs<'js>>(
        &self,
        k: K,
        object_name: &'static str,
    ) -> Result<V>;
    fn into_object_or_throw(
        self,
        ctx: &Ctx<'js>,
        object_name: &'static str,
    ) -> Result<Object<'js>>;
}

Required Methods§

Source

fn get_optional<K: IntoAtom<'js> + Clone, V: FromJs<'js>>( &self, k: K, ) -> Result<Option<V>>

Source

fn get_required<K: AsRef<str>, V: FromJs<'js>>( &self, k: K, object_name: &'static str, ) -> Result<V>

Source

fn into_object_or_throw( self, ctx: &Ctx<'js>, object_name: &'static str, ) -> Result<Object<'js>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'js> ObjectExt<'js> for Object<'js>

Source§

fn get_optional<K: IntoAtom<'js> + Clone, V: FromJs<'js> + Sized>( &self, k: K, ) -> Result<Option<V>>

Source§

fn get_required<K: AsRef<str>, V: FromJs<'js>>( &self, k: K, object_name: &'static str, ) -> Result<V>

Source§

fn into_object_or_throw( self, _: &Ctx<'js>, _: &'static str, ) -> Result<Object<'js>>

Source§

impl<'js> ObjectExt<'js> for Value<'js>

Source§

fn get_optional<K: IntoAtom<'js> + Clone, V: FromJs<'js>>( &self, k: K, ) -> Result<Option<V>>

Source§

fn get_required<K: AsRef<str>, V: FromJs<'js>>( &self, k: K, object_name: &'static str, ) -> Result<V>

Source§

fn into_object_or_throw( self, ctx: &Ctx<'js>, object_name: &'static str, ) -> Result<Object<'js>>

Implementors§