Module bare.util

Classes

class Field (ty: Type[BAREType], attr: str | None = None)

A descriptor that assists with assigning/retrieving values from a BARE Struct. It is reponsible for performing type validation on assignment of struct fields.

For example:

class MyStruct(Struct):
    a = Field(UInt)
    b = Field(Str)
Expand source code
def __get__(self, inst, _) -> T | Type[BAREType[T]]:
    if inst is None:
        return self.ty
    return inst.__dict__[self.attr]

Class variables

var attr : str
var name : str
var ty : Type[BAREType]