- renamed StructField to TStructField
- renamed UnionField to TUnionField
This commit is contained in:
parent
ede0840a0b
commit
865d73a292
4 changed files with 6 additions and 21 deletions
|
|
@ -1,14 +1,14 @@
|
|||
from .tarray import TArray
|
||||
from .tenum import TEnum
|
||||
from .tstruct import TStruct, TBitStruct, StructField
|
||||
from .tunion import TUnion, UnionField
|
||||
from .tstruct import TStruct, TBitStruct, TStructField
|
||||
from .tunion import TUnion, TUnionField
|
||||
|
||||
__all__ = [
|
||||
"StructField",
|
||||
"TStructField",
|
||||
"TStruct",
|
||||
"TBitStruct",
|
||||
"TEnum",
|
||||
"UnionField",
|
||||
"TUnionField",
|
||||
"TUnion",
|
||||
"TArray"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
from construct.core import *
|
||||
from construct_typed import *
|
||||
|
||||
a = Const(b"asd")
|
||||
|
||||
class Image(TypedContainer):
|
||||
signature: Subcon(Const(b"asd"))
|
||||
width: Subcon(Int8ub)
|
||||
height: Subcon(Int8ub)
|
||||
pixels: Subcon(Array(cs.this.width * cs.this.height, Byte()))
|
||||
|
||||
format = TypedStruct(Image)
|
||||
obj = Image(width=3, height=2, pixels=[7, 8, 9, 11, 12, 13])
|
||||
print(format.build(obj))
|
||||
print(format.parse(b"BMP\x03\x02\x07\x08\t\x0b\x0c\r"))
|
||||
|
|
@ -6,7 +6,7 @@ from .generic_wrapper import *
|
|||
DataclassType = t.TypeVar("DataclassType")
|
||||
|
||||
|
||||
def StructField(
|
||||
def TStructField(
|
||||
subcon: Construct[ParsedType, BuildTypes],
|
||||
doc: t.Optional[str] = None,
|
||||
parsed: t.Optional[t.Callable[[t.Any, "cs.Context"], None]] = None,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from .generic_wrapper import *
|
|||
DataclassType = t.TypeVar("DataclassType")
|
||||
|
||||
|
||||
def UnionField(
|
||||
def TUnionField(
|
||||
subcon: Construct[ParsedType, BuildTypes],
|
||||
doc: t.Optional[str] = None,
|
||||
parsed: t.Optional[t.Callable[[t.Any, "cs.Context"], None]] = None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue