Core API: Special

construct.Renamed(subcon, newname=None, newdocs=None, newparsed=None)

Special wrapper that allows a Struct (or other similar class) to see a field as having a name (or a different name) or having a parsed hook. Library classes do not have names (its None). Renamed does not change a field, only wraps it like a candy with a label. Used internally by / and * operators.

Also this wrapper is responsible for building a path info (a chain of names) that gets attached to error message when parsing, building, or sizeof fails. Fields that are not named do not appear in the path string.

Parsing building and size are deferred to subcon.

  • subcon – Construct instance

  • newname – optional, string

  • newdocs – optional, string

  • newparsed – optional, lambda


>>> "number" / Int32ub
<Renamed: number>