[][src]Attribute Macro milter_callback::on_body

#[on_body]

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

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

The on_body callback handles processing of message body content. Content is transferred in possibly more than one byte chunks. The callback may therefore be called multiple times for a single message. The signature of the annotated function must be as specified below.

Arguments:

  • Context<T> – the callback context
  • &[u8] – a content chunk of the message body

Return type:

  • Status – the response status

Examples

use milter::{Context, Status};

#[on_body(body_callback)]
fn handle_body(context: Context<MyData>, content_chunk: &[u8]) -> Status {
    Status::Continue
}