pyodide_webassembly_runtime_layer

Struct Engine

Source
pub struct Engine { /* private fields */ }
Expand description

Runtime for WebAssembly web runtime.

Trait Implementations§

Source§

impl<T> AsContext<Engine> for Store<T>

Source§

type UserState = T

The type of data associated with the store.
Source§

fn as_context(&self) -> StoreContext<'_, T>

Returns the store context that this type provides access to.
Source§

impl<'a, T: 'a> AsContext<Engine> for StoreContext<'a, T>

Source§

type UserState = T

The type of data associated with the store.
Source§

fn as_context(&self) -> StoreContext<'_, T>

Returns the store context that this type provides access to.
Source§

impl<'a, T: 'a> AsContext<Engine> for StoreContextMut<'a, T>

Source§

type UserState = T

The type of data associated with the store.
Source§

fn as_context(&self) -> StoreContext<'_, T>

Returns the store context that this type provides access to.
Source§

impl<T> AsContextMut<Engine> for Store<T>

Source§

fn as_context_mut(&mut self) -> StoreContextMut<'_, T>

Returns the store context that this type provides access to.
Source§

impl<'a, T: 'a> AsContextMut<Engine> for StoreContextMut<'a, T>

Source§

fn as_context_mut(&mut self) -> StoreContextMut<'_, T>

Returns the store context that this type provides access to.
Source§

impl Clone for Engine

Source§

fn clone(&self) -> Engine

Returns a copy 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 Debug for Engine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Engine

Source§

fn default() -> Engine

Returns the “default value” for a type. Read more
Source§

impl WasmEngine for Engine

Source§

type ExternRef = ExternRef

The external reference type.
Source§

type Func = Func

The function type.
Source§

type Global = Global

The global type.
Source§

type Instance = Instance

The instance type.
Source§

type Memory = Memory

The memory type.
Source§

type Module = Module

The module type.
Source§

type Store<T> = Store<T>

The store type.
Source§

type StoreContext<'a, T: 'a> = StoreContext<'a, T>

The store context type.
Source§

type StoreContextMut<'a, T: 'a> = StoreContextMut<'a, T>

The mutable store context type.
Source§

type Table = Table

The table type.
Source§

impl WasmExternRef<Engine> for ExternRef

Source§

fn new<T: 'static + Send + Sync>( _ctx: impl AsContextMut<Engine>, object: T, ) -> Self

Creates a new reference wrapping the given value.
Source§

fn downcast<'a, 's: 'a, T: 'static, S: 's>( &'a self, _ctx: StoreContext<'s, S>, ) -> Result<&'a T>

Returns a shared reference to the underlying data.
Source§

impl WasmFunc<Engine> for Func

Source§

fn new<T>( ctx: impl AsContextMut<Engine, UserState = T>, ty: FuncType, func: impl 'static + Send + Sync + Fn(StoreContextMut<'_, T>, &[Value<Engine>], &mut [Value<Engine>]) -> Result<()>, ) -> Self

Creates a new function with the given arguments.
Source§

fn ty(&self, _ctx: impl AsContext<Engine>) -> FuncType

Gets the function type of this object.
Source§

fn call<T>( &self, ctx: impl AsContextMut<Engine>, args: &[Value<Engine>], results: &mut [Value<Engine>], ) -> Result<()>

Calls the object with the given arguments.
Source§

impl WasmGlobal<Engine> for Global

Source§

fn new( _ctx: impl AsContextMut<Engine>, value: Value<Engine>, mutable: bool, ) -> Self

Creates a new global variable to the store.
Source§

fn ty(&self, _ctx: impl AsContext<Engine>) -> GlobalType

Returns the type of the global variable.
Source§

fn set( &self, _ctx: impl AsContextMut<Engine>, new_value: Value<Engine>, ) -> Result<()>

Sets the value of the global variable.
Source§

fn get(&self, _ctx: impl AsContextMut<Engine>) -> Value<Engine>

Gets the value of the global variable.
Source§

impl WasmInstance<Engine> for Instance

Source§

fn new( _store: impl AsContextMut<Engine>, module: &Module, imports: &Imports<Engine>, ) -> Result<Self>

Creates a new instance.
Source§

fn exports( &self, _store: impl AsContext<Engine>, ) -> Box<dyn Iterator<Item = Export<Engine>>>

Gets the exports of this instance.
Source§

fn get_export( &self, _store: impl AsContext<Engine>, name: &str, ) -> Option<Extern<Engine>>

Gets the export of the given name, if any, from this instance.
Source§

impl WasmMemory<Engine> for Memory

Source§

fn new(_ctx: impl AsContextMut<Engine>, ty: MemoryType) -> Result<Self>

Creates a new linear memory to the store.
Source§

fn ty(&self, _ctx: impl AsContext<Engine>) -> MemoryType

Returns the memory type of the linear memory.
Source§

fn grow(&self, _ctx: impl AsContextMut<Engine>, additional: u32) -> Result<u32>

Grows the linear memory by the given amount of new pages.
Source§

fn current_pages(&self, _ctx: impl AsContext<Engine>) -> u32

Returns the amount of pages in use by the linear memory.
Source§

fn read( &self, _ctx: impl AsContext<Engine>, offset: usize, buffer: &mut [u8], ) -> Result<()>

Reads n bytes from memory[offset..offset+n] into buffer where n is the length of buffer.
Source§

fn write( &self, _ctx: impl AsContextMut<Engine>, offset: usize, buffer: &[u8], ) -> Result<()>

Writes n bytes to memory[offset..offset+n] from buffer where n if the length of buffer.
Source§

impl WasmModule<Engine> for Module

Source§

fn new(_engine: &Engine, stream: impl Read) -> Result<Self>

Creates a new module from the given byte stream.
Source§

fn exports(&self) -> Box<dyn Iterator<Item = ExportType<'_>> + '_>

Gets the export types of the module.
Source§

fn get_export(&self, name: &str) -> Option<ExternType>

Gets the export type of the given name, if any, from this module.
Source§

fn imports(&self) -> Box<dyn Iterator<Item = ImportType<'_>> + '_>

Gets the import types of the module.
Source§

impl<T> WasmStore<T, Engine> for Store<T>

Source§

fn new(engine: &Engine, data: T) -> Self

Creates a new store atop the given engine.
Source§

fn engine(&self) -> &Engine

Gets the engine associated with this store.
Source§

fn data(&self) -> &T

Gets an immutable reference to the underlying stored data.
Source§

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

Gets a mutable reference to the underlying stored data.
Source§

fn into_data(self) -> T

Consumes self and returns its user provided data.
Source§

impl<'a, T: 'a> WasmStoreContext<'a, T, Engine> for StoreContext<'a, T>

Source§

fn engine(&self) -> &Engine

Gets the engine associated with this store.
Source§

fn data(&self) -> &T

Gets an immutable reference to the underlying stored data.
Source§

impl<'a, T: 'a> WasmStoreContext<'a, T, Engine> for StoreContextMut<'a, T>

Source§

fn engine(&self) -> &Engine

Gets the engine associated with this store.
Source§

fn data(&self) -> &T

Gets an immutable reference to the underlying stored data.
Source§

impl<'a, T: 'a> WasmStoreContextMut<'a, T, Engine> for StoreContextMut<'a, T>

Source§

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

Gets a mutable reference to the underlying stored data.
Source§

impl WasmTable<Engine> for Table

Source§

fn ty(&self, _ctx: impl AsContext<Engine>) -> TableType

Returns the type and limits of the table.

Source§

fn size(&self, _ctx: impl AsContext<Engine>) -> u32

Returns the current size of the table.

Source§

fn grow( &self, _ctx: impl AsContextMut<Engine>, delta: u32, init: Value<Engine>, ) -> Result<u32>

Grows the table by the given amount of elements.

Source§

fn get( &self, _ctx: impl AsContextMut<Engine>, index: u32, ) -> Option<Value<Engine>>

Returns the table element value at index.

Source§

fn set( &self, _ctx: impl AsContextMut<Engine>, index: u32, value: Value<Engine>, ) -> Result<()>

Sets the value of this table at index.

Source§

fn new( _ctx: impl AsContextMut<Engine>, ty: TableType, init: Value<Engine>, ) -> Result<Self>

Creates a new table to the store.

Auto Trait Implementations§

§

impl Freeze for Engine

§

impl RefUnwindSafe for Engine

§

impl Send for Engine

§

impl Sync for Engine

§

impl Unpin for Engine

§

impl UnwindSafe for Engine

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> CloneToUninit for T
where T: Clone,

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> 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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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