delegate_envelope_visitor

Macro delegate_envelope_visitor 

Source
macro_rules! delegate_envelope_visitor {
    ($struct_name:ident) => { ... };
}
Expand description

Macro to delegate EnvelopeVisitor implementation to an inner field.

This macro generates a complete EnvelopeVisitor implementation for a struct that contains an inner field implementing EnvelopeVisitor (typically a tuple of extractors).

ยงExample

use xmtp_api_d14n::protocol::extractors::{DependsOnExtractor, BytesExtractor};
use xmtp_api_d14n::delegate_envelope_visitor;

struct MyExtractor {
    inner: (DependsOnExtractor, BytesExtractor)
}

delegate_envelope_visitor!(MyExtractor);

The generated implementation delegates all visitor methods to the inner field, allowing you to compose multiple extractors without manually implementing each method. This is particularly useful when you want to wrap a tuple of extractors in a named struct for better type safety and API clarity.