Show / Hide Table of Contents

Struct Caller

Represents caller information for a function.

Namespace: Wasmtime
Assembly: Wasmtime.Dotnet.dll
Syntax
public ref readonly struct Caller

Properties

| Improve this Doc View Source

Store

Gets the Store associated with this caller.

Declaration
public readonly Store Store { get; }
Property Value
Type Description
Store

Methods

| Improve this Doc View Source

AddFuel(UInt64)

Adds fuel to this store for WebAssembly code to consume while executing.

Declaration
public readonly void AddFuel(ulong fuel)
Parameters
Type Name Description
System.UInt64 fuel

The fuel to add to the store.

| Improve this Doc View Source

ConsumeFuel(UInt64)

Synthetically consumes fuel from this store.

For this method to work fuel consumption must be enabled via WithFuelConsumption(Boolean).

WebAssembly execution will automatically consume fuel but if so desired the embedder can also consume fuel manually to account for relative costs of host functions, for example.

This method will attempt to consume fuel units of fuel from within this store. If the remaining amount of fuel allows this then the amount of remaining fuel is returned. Otherwise, a WasmtimeException is thrown and no fuel is consumed.

Declaration
public readonly ulong ConsumeFuel(ulong fuel)
Parameters
Type Name Description
System.UInt64 fuel

The fuel to consume from the store.

Returns
Type Description
System.UInt64

Returns the remaining amount of fuel.

Exceptions
Type Condition
WasmtimeException

Thrown if more fuel is consumed than the store currently has.

| Improve this Doc View Source

GetConsumedFuel()

Gets the fuel consumed by the executing WebAssembly code.

Declaration
public readonly ulong GetConsumedFuel()
Returns
Type Description
System.UInt64

Returns the fuel consumed by the executing WebAssembly code or 0 if fuel consumption was not enabled.

| Improve this Doc View Source

GetData()

Gets the user-defined data from the Store.

Declaration
public readonly object? GetData()
Returns
Type Description
System.Nullable<System.Object>

An object represeting the user defined data from this Store

| Improve this Doc View Source

GetFunction(String)

Gets an exported function of the caller by the given name.

Declaration
public readonly Function GetFunction(string name)
Parameters
Type Name Description
System.String name

The name of the exported function.

Returns
Type Description
Function

Returns the exported function if found or null if a function of the requested name is not exported.

| Improve this Doc View Source

GetMemory(String)

Gets an exported memory of the caller by the given name.

Declaration
public readonly Memory GetMemory(string name)
Parameters
Type Name Description
System.String name

The name of the exported memory.

Returns
Type Description
Memory

Returns the exported memory if found or null if a memory of the requested name is not exported.

| Improve this Doc View Source

SetData(Nullable<Object>)

Replaces the user-defined data in the Store.

Declaration
public readonly void SetData(object? data)
Parameters
Type Name Description
System.Nullable<System.Object> data
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX