AnyPtr

Struct AnyPtr 

Source
pub struct AnyPtr(/* private fields */);

Implementations§

Source§

impl AnyPtr

Source

pub fn new(offset: u32) -> Self

Source

pub fn to_type(self, memory: &Memory) -> Result<Type>

Source

pub fn offset(&self) -> u32

Get ptr stored offset

Source

pub fn export(&self, memory: &Memory) -> Result<AnyPtrExported>

Source

pub fn import(ptr_exported: &AnyPtrExported, env: &Env) -> Result<Type>

Create a new pointer with an allocation and write the pointer that has been writen. Return a pointer type.

Trait Implementations§

Source§

impl Clone for AnyPtr

Source§

fn clone(&self) -> AnyPtr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl FromToNativeWasmType for AnyPtr

Source§

type Native = i32

Native Wasm type.
Source§

fn to_native(self) -> Self::Native

Convert self to Self::Native. Read more
Source§

fn from_native(n: Self::Native) -> Self

Convert a value of kind Self::Native to Self. Read more
Source§

impl Read<Vec<u8>> for AnyPtr

Source§

fn read(&self, memory: &Memory) -> Result<Vec<u8>>

Read the value contained in the given memory at the current pointer offset. Read more
Source§

fn size(&self, memory: &Memory) -> Result<u32>

Read the size as indicated in the AssemblyScript object header Read more
Source§

impl Write<Vec<u8>> for AnyPtr

Source§

fn alloc(value: &Vec<u8>, env: &Env) -> Result<Box<AnyPtr>>

Try to write in the given environment a new value thanks to the AssemblyScript runtime. Read more
Source§

fn write(&mut self, value: &Vec<u8>, env: &Env) -> Result<Box<Self>>

Try to write in the given environment a value. If the size is different, we procede to free the previous string and realloc a new pointer. Read more
Source§

fn free(self, _env: &Env) -> Result<()>

Unpin the pointer
Source§

impl Copy for AnyPtr

Auto Trait Implementations§

§

impl Freeze for AnyPtr

§

impl RefUnwindSafe for AnyPtr

§

impl Send for AnyPtr

§

impl Sync for AnyPtr

§

impl Unpin for AnyPtr

§

impl UnwindSafe for AnyPtr

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

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

Source§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
Source§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
Source§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
Source§

impl<A1> WasmTypeList for A1

Source§

type CStruct = S1<A1>

The C type (a struct) that can hold/represent all the represented values.
Source§

type Array = [i128; 1]

The array type that can hold all the represented values. Read more
Source§

fn from_array(array: <A1 as WasmTypeList>::Array) -> A1

Constructs Self based on an array of values.
Source§

fn from_slice(slice: &[i128]) -> Result<A1, TryFromSliceError>

Constructs Self based on a slice of values. Read more
Source§

fn into_array(self) -> <A1 as WasmTypeList>::Array

Builds and returns an array of type Array from a tuple (list) of values.
Source§

fn empty_array() -> <A1 as WasmTypeList>::Array

Allocates and return an empty array of type Array that will hold a tuple (list) of values, usually to hold the returned values of a WebAssembly function call.
Source§

fn from_c_struct(c_struct: <A1 as WasmTypeList>::CStruct) -> A1

Builds a tuple (list) of values from a C struct of type CStruct.
Source§

fn into_c_struct(self) -> <A1 as WasmTypeList>::CStruct

Builds and returns a C struct of type CStruct from a tuple (list) of values.
Source§

fn wasm_types() -> &'static [Type]

Get the Wasm types for the tuple (list) of currently represented values.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more