Skip to main content

ExtensionHandler

Trait ExtensionHandler 

Source
pub trait ExtensionHandler: Send + Sync {
    // Required methods
    fn field_type(&self) -> u16;
    fn handle(&self, value: &[u8]) -> Result<(), Error>;
}
Expand description

A handler trait for processing extension fields.

Implement this trait to create custom extension field handlers that can be registered in an ExtensionRegistry.

Required Methods§

Source

fn field_type(&self) -> u16

Return the extension field type code this handler processes.

Source

fn handle(&self, value: &[u8]) -> Result<(), Error>

Process an extension field value.

Returns Ok(()) if the field was successfully processed, or an error describing why processing failed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§