Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
rustruct
rustruct
  • Tutorials
    • 1. Install rustruct
    • 2. Define and pack a structure
    • 3. Decode the message
    • 4. Try partial input
    • 5. Inspect an error
    • 1. Decode an IPv4 packet
    • 2. Build an IPv4 packet with UDP
    • 3. Build and decode a DNS query
    • 4. Create a minimal PNG container
    • 5. Create a transparent 1×1 PNG
  • How-to guides
    • How to choose field types
    • How to compute and verify a digest
    • How to model collections and nesting
    • How to model enums and bit fields
    • How to model computed and conditional fields
    • How to model tagged unions
    • How to compile mapping-based schemas
    • How to extend the schema
    • How to use the IPv4 model
    • How to use the DNS model
    • How to build and decode PNG files
    • How to decode and encode MessagePack values
    • How to decode untrusted, deeply-nested MessagePack safely
    • How to benchmark
  • Explanation
    • How schemas work
    • Architecture and execution model
    • Native program reference
    • Extension model
    • Understanding performance
  • API reference
    • Structures
    • Fields and declarations
    • Declarative schema language
    • Low-level schema language
    • Runtime API
    • Extension API
    • Protocol and format API
Back to top

Extension API¶

The supported Python extension points are declarative:

  • rustruct.convert() transforms one decoded value;

  • rustruct.switch() selects a declared wire shape;

  • rustruct.registry() creates a reusable case registry;

  • rustruct.compile() builds generated mapping-based schemas.

There is no public cursor or custom field-codec base in this release. See How to extend the schema for practical extension patterns and Extension model for the design boundary.

Next
Protocol and format API
Previous
Runtime API
Copyright © 2026, Dmitry Orlov
Made with Sphinx and @pradyunsg's Furo