ifgen.struct.methods package — docs

Skip to main content
`Ctrl`+`K`

# ifgen.struct.methods package

## Subpackages

- ifgen.struct.methods.fields package
  - Submodules
  - ifgen.struct.methods.fields.common module
    - `bit_field_method_slug()`
    - `bit_field_underlying()`
    - `bit_mask_literal()`
    - `possible_array_arg()`
  - ifgen.struct.methods.fields.getter module
    - `bit_field_get_all_method()`
    - `bit_field_get_method()`
    - `get_bit_field_statement()`
  - ifgen.struct.methods.fields.setter module
    - `bit_field_set_all_method()`
    - `bit_field_set_lines()`
    - `bit_field_set_method()`
  - Module contents
    - `bit_field()`
    - `bit_fields()`
    - `handle_atomic_fields_methods()`

## Submodules

## ifgen.struct.methods.bit module

A module implementing interfaces for generating bit-field methods.

ifgen.struct.methods.bit.bit_field_toggle_method(task: GenerateTask, name: str, field: dict[str, Any], writer: IndentedFileWriter, method_slug: str) → None

  Generate a ‘toggle’ method for a bit-field.

ifgen.struct.methods.bit.clear_bit_method(task: GenerateTask, name: str, field: dict[str, Any], writer: IndentedFileWriter, method_slug: str) → None

  Generate a ‘clear’ method for a bit-field.

ifgen.struct.methods.bit.handle_description(writer: IndentedFileWriter, field: dict[str, Any]) → None

  Handle writing an instance’s description.

ifgen.struct.methods.bit.set_bit_method(task: GenerateTask, name: str, field: dict[str, Any], writer: IndentedFileWriter, method_slug: str) → None

  Generate a ‘set’ method for a bit-field.

## ifgen.struct.methods.common module

Utilities shared between struct methods.

ifgen.struct.methods.common.swap_fields(task: GenerateTask, writer: IndentedFileWriter, elem_prefix: str = '') → None

  Generate code for swapping struct fields.

## Module contents

A module implementing interfaces for generating struct method code.

ifgen.struct.methods.decode_endian(task: GenerateTask, writer: IndentedFileWriter) → None

  Write a struct method for decoding buffers.

ifgen.struct.methods.encode_endian(task: GenerateTask, writer: IndentedFileWriter) → None

  Write a struct method for encoding buffers.

ifgen.struct.methods.endian_str(task: GenerateTask) → str

  Get the appropriate default endian argument for this struct.

ifgen.struct.methods.handle_endian(task: GenerateTask, writer: IndentedFileWriter) → None

  Write a struct method for byte swapping.

ifgen.struct.methods.protocol_json(task: GenerateTask) → dict[str, Any]

  Get JSON data for this struct task.

ifgen.struct.methods.span_method(task: GenerateTask, writer: IndentedFileWriter) → None

  Generate a span method.

ifgen.struct.methods.struct_buffer_method(task: GenerateTask, writer: IndentedFileWriter, read_only: bool) → None

  Generate a method for raw buffer access.

ifgen.struct.methods.struct_methods(task: GenerateTask, writer: IndentedFileWriter) → None

  Write generated-struct methods.