Module wasmtime.bindgen.generated.imports.streams
Classes
class HostStreams (*args, **kwargs)
-
Expand source code
class HostStreams(Protocol): @abstractmethod def drop_input_stream(self, this: InputStream) -> None: raise NotImplementedError @abstractmethod def write(self, this: OutputStream, buf: bytes) -> Result[Tuple[int, StreamStatus], None]: raise NotImplementedError @abstractmethod def blocking_write(self, this: OutputStream, buf: bytes) -> Result[Tuple[int, StreamStatus], None]: raise NotImplementedError @abstractmethod def drop_output_stream(self, this: OutputStream) -> 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.WasiStreams
Methods
def blocking_write(self, this: int, buf: bytes) ‑> Ok[typing.Tuple[int, StreamStatus]] | Err[None]
-
Expand source code
@abstractmethod def blocking_write(self, this: OutputStream, buf: bytes) -> Result[Tuple[int, StreamStatus], None]: raise NotImplementedError
def drop_input_stream(self, this: int) ‑> None
-
Expand source code
@abstractmethod def drop_input_stream(self, this: InputStream) -> None: raise NotImplementedError
def drop_output_stream(self, this: int) ‑> None
-
Expand source code
@abstractmethod def drop_output_stream(self, this: OutputStream) -> None: raise NotImplementedError
def write(self, this: int, buf: bytes) ‑> Ok[typing.Tuple[int, StreamStatus]] | Err[None]
-
Expand source code
@abstractmethod def write(self, this: OutputStream, buf: bytes) -> Result[Tuple[int, StreamStatus], None]: raise NotImplementedError
class StreamStatus (*args, **kwds)
-
Expand source code
class StreamStatus(Enum): OPEN = 0 ENDED = 1
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 ENDED
var OPEN