Extension

Trait Extension 

Source
pub trait Extension: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn validate(&self, value: &ExtensionValue) -> Result<(), String>;

    // Provided methods
    fn transform(&self, value: ExtensionValue) -> Result<ExtensionValue, String> { ... }
    fn is_compatible(&self, _version: ProtocolVersion) -> bool { ... }
}
Expand description

Extension trait for custom protocol extensions

Required Methods§

Source

fn name(&self) -> &str

Extension name (must be unique)

Source

fn validate(&self, value: &ExtensionValue) -> Result<(), String>

Validate extension value

Provided Methods§

Source

fn transform(&self, value: ExtensionValue) -> Result<ExtensionValue, String>

Transform extension value (optional)

Source

fn is_compatible(&self, _version: ProtocolVersion) -> bool

Check if extension is compatible with protocol version

Implementors§