Trait Consumer

Source
pub trait Consumer {
    // Required methods
    fn initialize(&mut self) -> Action;
    fn finalize(&mut self) -> Action;
    fn consume_header(&mut self, module: ModuleHeader) -> Action;
    fn consume_instruction(&mut self, inst: Instruction) -> Action;
}
Expand description

The binary consumer trait.

The parser will call initialize before parsing the SPIR-V binary and finalize after successfully parsing the whle binary.

After successfully parsing the module header, consume_header will be called. After successfully parsing an instruction, consume_instruction will be called.

The consumer can use Action to control the parsing process.

Required Methods§

Source

fn initialize(&mut self) -> Action

Intialize the consumer.

Source

fn finalize(&mut self) -> Action

Finalize the consumer.

Source

fn consume_header(&mut self, module: ModuleHeader) -> Action

Consume the module header.

Source

fn consume_instruction(&mut self, inst: Instruction) -> Action

Consume the given instruction.

Implementors§