| # 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.time"] |
| add_ir_path(_ir_path) |
| |
| |
| @dataclass |
| class AllInstants: |
| monotonic: int |
| boot: int |
| monotonic_ticks: int |
| boot_ticks: int |
| |
| __fidl_kind__ = "struct" |
| __fidl_type__ = "AllInstants" |
| __fidl_raw_type__ = "test.time/AllInstants" |
| |
| # 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.time", "test.time/AllInstants") |
| |
| # 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( |
| **{ |
| "monotonic": None, # type: ignore[arg-type,unused-ignore] |
| "boot": None, # type: ignore[arg-type,unused-ignore] |
| "monotonic_ticks": None, # type: ignore[arg-type,unused-ignore] |
| "boot_ticks": None, # type: ignore[arg-type,unused-ignore] |
| } |
| ) |
| |
| |
| @dataclass |
| class ComplexInstants: |
| monotonic: typing.Sequence[int] | None |
| boot: typing.Sequence[int] | None |
| monotonic_ticks: typing.Sequence[int] | None |
| boot_ticks: typing.Sequence[int] | None |
| |
| def __init__( |
| self, |
| monotonic: typing.Sequence[int] | None = None, |
| boot: typing.Sequence[int] | None = None, |
| monotonic_ticks: typing.Sequence[int] | None = None, |
| boot_ticks: typing.Sequence[int] | None = None, |
| ) -> None: |
| self.monotonic = monotonic |
| self.boot = boot |
| self.monotonic_ticks = monotonic_ticks |
| self.boot_ticks = boot_ticks |
| |
| __fidl_kind__ = "table" |
| __fidl_type__ = "ComplexInstants" |
| __fidl_raw_type__ = "test.time/ComplexInstants" |
| |
| # 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.time", "test.time/ComplexInstants" |
| ) |
| |
| @classmethod |
| def make_default(cls) -> typing.Self: |
| return cls() |