Coverage for wasmtime/bindgen/generated/imports/types.py: 94%
68 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-02-20 16:25 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-02-20 16:25 +0000
1from ..imports import streams
2from ..types import Result
3from abc import abstractmethod
4from enum import Enum
5from typing import Protocol
7Descriptor = int
8Filesize = int
9OutputStream = streams.OutputStream
10class ErrorCode(Enum):
11 ACCESS = 0
12 WOULD_BLOCK = 1
13 ALREADY = 2
14 BAD_DESCRIPTOR = 3
15 BUSY = 4
16 DEADLOCK = 5
17 QUOTA = 6
18 EXIST = 7
19 FILE_TOO_LARGE = 8
20 ILLEGAL_BYTE_SEQUENCE = 9
21 IN_PROGRESS = 10
22 INTERRUPTED = 11
23 INVALID = 12
24 IO = 13
25 IS_DIRECTORY = 14
26 LOOP = 15
27 TOO_MANY_LINKS = 16
28 MESSAGE_SIZE = 17
29 NAME_TOO_LONG = 18
30 NO_DEVICE = 19
31 NO_ENTRY = 20
32 NO_LOCK = 21
33 INSUFFICIENT_MEMORY = 22
34 INSUFFICIENT_SPACE = 23
35 NOT_DIRECTORY = 24
36 NOT_EMPTY = 25
37 NOT_RECOVERABLE = 26
38 UNSUPPORTED = 27
39 NO_TTY = 28
40 NO_SUCH_DEVICE = 29
41 OVERFLOW = 30
42 NOT_PERMITTED = 31
43 PIPE = 32
44 READ_ONLY = 33
45 INVALID_SEEK = 34
46 TEXT_FILE_BUSY = 35
47 CROSS_DEVICE = 36
49class DescriptorType(Enum):
50 UNKNOWN = 0
51 BLOCK_DEVICE = 1
52 CHARACTER_DEVICE = 2
53 DIRECTORY = 3
54 FIFO = 4
55 SYMBOLIC_LINK = 5
56 REGULAR_FILE = 6
57 SOCKET = 7
59class HostTypes(Protocol):
60 @abstractmethod
61 def write_via_stream(self, this: Descriptor, offset: Filesize) -> Result[OutputStream, ErrorCode]:
62 raise NotImplementedError
63 @abstractmethod
64 def append_via_stream(self, this: Descriptor) -> Result[OutputStream, ErrorCode]:
65 raise NotImplementedError
66 @abstractmethod
67 def get_type(self, this: Descriptor) -> Result[DescriptorType, ErrorCode]:
68 raise NotImplementedError
69 @abstractmethod
70 def drop_descriptor(self, this: Descriptor) -> None:
71 raise NotImplementedError