Module wasmtime.bindgen.generated.imports.types

Classes

class DescriptorType (*args, **kwds)
Expand source code
class DescriptorType(Enum):
    UNKNOWN = 0
    BLOCK_DEVICE = 1
    CHARACTER_DEVICE = 2
    DIRECTORY = 3
    FIFO = 4
    SYMBOLIC_LINK = 5
    REGULAR_FILE = 6
    SOCKET = 7

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Ancestors

  • enum.Enum

Class variables

var BLOCK_DEVICE
var CHARACTER_DEVICE
var DIRECTORY
var FIFO
var REGULAR_FILE
var SOCKET
var UNKNOWN
class ErrorCode (*args, **kwds)
Expand source code
class ErrorCode(Enum):
    ACCESS = 0
    WOULD_BLOCK = 1
    ALREADY = 2
    BAD_DESCRIPTOR = 3
    BUSY = 4
    DEADLOCK = 5
    QUOTA = 6
    EXIST = 7
    FILE_TOO_LARGE = 8
    ILLEGAL_BYTE_SEQUENCE = 9
    IN_PROGRESS = 10
    INTERRUPTED = 11
    INVALID = 12
    IO = 13
    IS_DIRECTORY = 14
    LOOP = 15
    TOO_MANY_LINKS = 16
    MESSAGE_SIZE = 17
    NAME_TOO_LONG = 18
    NO_DEVICE = 19
    NO_ENTRY = 20
    NO_LOCK = 21
    INSUFFICIENT_MEMORY = 22
    INSUFFICIENT_SPACE = 23
    NOT_DIRECTORY = 24
    NOT_EMPTY = 25
    NOT_RECOVERABLE = 26
    UNSUPPORTED = 27
    NO_TTY = 28
    NO_SUCH_DEVICE = 29
    OVERFLOW = 30
    NOT_PERMITTED = 31
    PIPE = 32
    READ_ONLY = 33
    INVALID_SEEK = 34
    TEXT_FILE_BUSY = 35
    CROSS_DEVICE = 36

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Ancestors

  • enum.Enum

Class variables

var ACCESS
var ALREADY
var BAD_DESCRIPTOR
var BUSY
var CROSS_DEVICE
var DEADLOCK
var EXIST
var FILE_TOO_LARGE
var ILLEGAL_BYTE_SEQUENCE
var INSUFFICIENT_MEMORY
var INSUFFICIENT_SPACE
var INTERRUPTED
var INVALID
var INVALID_SEEK
var IN_PROGRESS
var IO
var IS_DIRECTORY
var LOOP
var MESSAGE_SIZE
var NAME_TOO_LONG
var NOT_DIRECTORY
var NOT_EMPTY
var NOT_PERMITTED
var NOT_RECOVERABLE
var NO_DEVICE
var NO_ENTRY
var NO_LOCK
var NO_SUCH_DEVICE
var NO_TTY
var OVERFLOW
var PIPE
var QUOTA
var READ_ONLY
var TEXT_FILE_BUSY
var UNSUPPORTED
var WOULD_BLOCK
class HostTypes (*args, **kwargs)
Expand source code
class HostTypes(Protocol):
    @abstractmethod
    def write_via_stream(self, this: Descriptor, offset: Filesize) -> Result[OutputStream, ErrorCode]:
        raise NotImplementedError
    @abstractmethod
    def append_via_stream(self, this: Descriptor) -> Result[OutputStream, ErrorCode]:
        raise NotImplementedError
    @abstractmethod
    def get_type(self, this: Descriptor) -> Result[DescriptorType, ErrorCode]:
        raise NotImplementedError
    @abstractmethod
    def drop_descriptor(self, this: Descriptor) -> None:
        raise NotImplementedError

Base class for protocol classes.

Protocol classes are defined as::

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example::

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...

Ancestors

  • typing.Protocol
  • typing.Generic

Subclasses

  • wasmtime.bindgen.WasiTypes

Methods

def append_via_stream(self, this: int) ‑> Ok[int] | Err[ErrorCode]
Expand source code
@abstractmethod
def append_via_stream(self, this: Descriptor) -> Result[OutputStream, ErrorCode]:
    raise NotImplementedError
def drop_descriptor(self, this: int) ‑> None
Expand source code
@abstractmethod
def drop_descriptor(self, this: Descriptor) -> None:
    raise NotImplementedError
def get_type(self, this: int) ‑> Ok[DescriptorType] | Err[ErrorCode]
Expand source code
@abstractmethod
def get_type(self, this: Descriptor) -> Result[DescriptorType, ErrorCode]:
    raise NotImplementedError
def write_via_stream(self, this: int, offset: int) ‑> Ok[int] | Err[ErrorCode]
Expand source code
@abstractmethod
def write_via_stream(self, this: Descriptor, offset: Filesize) -> Result[OutputStream, ErrorCode]:
    raise NotImplementedError