CallbackKey

Struct CallbackKey 

Source
pub struct CallbackKey<F>(/* private fields */)
where
    F: ?Sized;
Expand description

Wrapper type that encodes a callback registration key with Callback type info. This tells JS to create a RustFunction wrapper when decoding the value. The type parameter F should be dyn FnMut(...) -> R to capture the callback signature.

Trait Implementations§

Source§

impl<F> BinaryEncode for CallbackKey<F>
where F: ?Sized,

Source§

fn encode(self, encoder: &mut EncodedData)

Source§

impl<R, A1> EncodeTypeDef for CallbackKey<fn(&A1) -> R>
where A1: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2> EncodeTypeDef for CallbackKey<fn(&A1, A2) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3> EncodeTypeDef for CallbackKey<fn(&A1, A2, A3) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3, A4> EncodeTypeDef for CallbackKey<fn(&A1, A2, A3, A4) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, A4: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3, A4, A5> EncodeTypeDef for CallbackKey<fn(&A1, A2, A3, A4, A5) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, A4: EncodeTypeDef + 'static, A5: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3, A4, A5, A6> EncodeTypeDef for CallbackKey<fn(&A1, A2, A3, A4, A5, A6) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, A4: EncodeTypeDef + 'static, A5: EncodeTypeDef + 'static, A6: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3, A4, A5, A6, A7> EncodeTypeDef for CallbackKey<fn(&A1, A2, A3, A4, A5, A6, A7) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, A4: EncodeTypeDef + 'static, A5: EncodeTypeDef + 'static, A6: EncodeTypeDef + 'static, A7: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R> EncodeTypeDef for CallbackKey<fn() -> R>
where R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1> EncodeTypeDef for CallbackKey<fn(A1) -> R>
where A1: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2> EncodeTypeDef for CallbackKey<fn(A1, A2) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3> EncodeTypeDef for CallbackKey<fn(A1, A2, A3) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3, A4> EncodeTypeDef for CallbackKey<fn(A1, A2, A3, A4) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, A4: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3, A4, A5> EncodeTypeDef for CallbackKey<fn(A1, A2, A3, A4, A5) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, A4: EncodeTypeDef + 'static, A5: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3, A4, A5, A6> EncodeTypeDef for CallbackKey<fn(A1, A2, A3, A4, A5, A6) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, A4: EncodeTypeDef + 'static, A5: EncodeTypeDef + 'static, A6: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.
Source§

impl<R, A1, A2, A3, A4, A5, A6, A7> EncodeTypeDef for CallbackKey<fn(A1, A2, A3, A4, A5, A6, A7) -> R>
where A1: EncodeTypeDef + 'static, A2: EncodeTypeDef + 'static, A3: EncodeTypeDef + 'static, A4: EncodeTypeDef + 'static, A5: EncodeTypeDef + 'static, A6: EncodeTypeDef + 'static, A7: EncodeTypeDef + 'static, R: EncodeTypeDef + 'static,

Source§

fn encode_type_def(buf: &mut Vec<u8>)

Encode this type’s definition into the buffer. For primitives, this is just the TypeTag byte. For callbacks, this includes param count, param types, and return type.

Auto Trait Implementations§

§

impl<F> Freeze for CallbackKey<F>
where F: ?Sized,

§

impl<F> RefUnwindSafe for CallbackKey<F>
where F: RefUnwindSafe + ?Sized,

§

impl<F> Send for CallbackKey<F>
where F: Send + ?Sized,

§

impl<F> Sync for CallbackKey<F>
where F: Sync + ?Sized,

§

impl<F> Unpin for CallbackKey<F>
where F: Unpin + ?Sized,

§

impl<F> UnwindSafe for CallbackKey<F>
where F: UnwindSafe + ?Sized,

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.