Attribute Macro milter_callback::on_header[][src]

#[on_header]
Expand description

Generates a callback function of type HeaderCallback that delegates to the annotated function.

As its sole argument on_header takes an identifier to be used as the name of the generated function.

The on_header callback handles processing of a message header line. It can be called multiple times for a single message. If the value spans multiple lines, line breaks are represented as \n (a single newline), not \r\n. The signature of the annotated function must be as specified below.

Arguments:

  • Context<T> – the callback context
  • &str – the header name
  • &str – the header value

Return type:

  • Status – the response status

Examples

use milter::{Context, Status};

#[on_header(header_callback)]
fn handle_header(context: Context<MyData>, name: &str, value: &str) -> Status {
    Status::Continue
}