rusttypes.traits
¶
- class rusttypes.traits.Default¶
Bases:
ABC
Default trait for use creating default instances of a type.
Example:
from __future__ import annotations from dataclasses import dataclass from rusttypes.traits import Default @dataclass class Foo(Default): value: int @staticmethod def default() -> Foo: return Foo(42) assert Foo.default() == Foo(42)
- abstract classmethod default() T ¶
Protopype method for creating a default instance of a type.