blob: 14d58357a4469eb40eff74fb578dced9307dfd32 [file] [log] [blame] [edit]
# WARNING: This file is machine generated by fidlgen.
from __future__ import annotations
from dataclasses import dataclass
from fidl_codec import add_ir_path, encode_fidl_object
import sys
import typing
import enum
import fidl
from fidl._ir import get_fidl_ir_map
_ir_path = get_fidl_ir_map()["test.driverhandle"]
add_ir_path(_ir_path)
@dataclass
class ClientEndWrapper:
value: int
__fidl_kind__ = "struct"
__fidl_type__ = "ClientEndWrapper"
__fidl_raw_type__ = "test.driverhandle/ClientEndWrapper"
# TODO(https://fxbug.dev/394421154): We should probably remove this method when we
# start making breaking changes.
def __getitem__(self, item: str): # type: ignore
if not isinstance(item, str):
raise TypeError("Subscripted item must be a string")
return getattr(self, item)
# TODO(https://fxbug.dev/394421154): We should probably return a more readable type.
def encode(self) -> tuple[bytes, list[tuple[int, int, int, int, int]]]:
return encode_fidl_object(
self, "test.driverhandle", "test.driverhandle/ClientEndWrapper"
)
# TODO(https://fxbug.dev/394421154): Assigning None (incorrectly) to each type is a consequence
# of needing to support creation of a "default object" before decoding.
@classmethod
def make_default(cls) -> typing.Self:
return cls(
**{
"value": None, # type: ignore[arg-type,unused-ignore]
}
)
@dataclass
class ServerEndWrapper:
value: int
__fidl_kind__ = "struct"
__fidl_type__ = "ServerEndWrapper"
__fidl_raw_type__ = "test.driverhandle/ServerEndWrapper"
# TODO(https://fxbug.dev/394421154): We should probably remove this method when we
# start making breaking changes.
def __getitem__(self, item: str): # type: ignore
if not isinstance(item, str):
raise TypeError("Subscripted item must be a string")
return getattr(self, item)
# TODO(https://fxbug.dev/394421154): We should probably return a more readable type.
def encode(self) -> tuple[bytes, list[tuple[int, int, int, int, int]]]:
return encode_fidl_object(
self, "test.driverhandle", "test.driverhandle/ServerEndWrapper"
)
# TODO(https://fxbug.dev/394421154): Assigning None (incorrectly) to each type is a consequence
# of needing to support creation of a "default object" before decoding.
@classmethod
def make_default(cls) -> typing.Self:
return cls(
**{
"value": None, # type: ignore[arg-type,unused-ignore]
}
)