External

Struct External 

Source
#[repr(C)]
pub struct External<T: 'static> { pub adjusted_size: i64, /* private fields */ }

Fields§

§adjusted_size: i64

Implementations§

Source§

impl<T: 'static> External<T>

Source

pub fn new(value: T) -> Self

Source

pub unsafe fn inner_from_raw_mut( unknown_tagged_object: *mut c_void, ) -> Option<&'static mut T>

Turn a raw pointer (from napi) pointing to an External into a mutable reference to the inner object.

§Safety

The unknown_tagged_object raw pointer must point to an External<T> struct.

Source

pub unsafe fn inner_from_raw( unknown_tagged_object: *mut c_void, ) -> Option<&'static T>

Turn a raw pointer (from napi) pointing to an External into a reference inner object.

§Safety

The unknown_tagged_object raw pointer must point to an External<T> struct.

Source

pub fn new_with_size_hint(value: T, size_hint: usize) -> Self

size_hint is a value to tell Node.js GC how much memory is used by this External object.

If getting the exact size_hint is difficult, you can provide an approximate value, it’s only effect to the GC.

If your External object is not effect to GC, you can use External::new instead.

Source

pub fn into_unknown(self, env: &Env) -> Result<Unknown<'_>>

convert External<T> to Unknown

Source

pub fn into_js_external(self, env: &Env) -> Result<JsExternal<'_>>

Convert External<T> to JsExternal

Trait Implementations§

Source§

impl<T: 'static> AsMut<T> for External<T>

Source§

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

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T: 'static> AsRef<T> for External<T>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: 'static> Deref for External<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: 'static> DerefMut for External<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T: 'static> From<T> for External<T>

Source§

fn from(t: T) -> Self

Converts to this type from the input type.
Source§

impl<T: 'static> FromNapiMutRef for External<T>

Source§

unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>

Safety Read more
Source§

impl<T: 'static> FromNapiRef for External<T>

Source§

unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>

Safety Read more
Source§

impl<T: 'static> ToNapiValue for External<T>

Source§

unsafe fn to_napi_value(env: napi_env, val: Self) -> Result<napi_value>

Safety Read more
Source§

fn into_unknown(self, env: &Env) -> Result<Unknown<'_>>

Source§

impl<T: 'static> TypeName for &External<T>

Source§

impl<T: 'static> TypeName for &mut External<T>

Source§

impl<T: 'static> ValidateNapiValue for &External<T>

Source§

unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>

Safety Read more
Source§

impl<T: 'static> ValidateNapiValue for &mut External<T>

Source§

unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>

Safety Read more

Auto Trait Implementations§

§

impl<T> Freeze for External<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for External<T>
where T: RefUnwindSafe,

§

impl<T> Send for External<T>
where T: Send,

§

impl<T> Sync for External<T>
where T: Sync,

§

impl<T> Unpin for External<T>
where T: Unpin,

§

impl<T> UnwindSafe for External<T>
where T: UnwindSafe,

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<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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> JsValuesTupleIntoVec for T
where T: ToNapiValue,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.