milter 0.1.0

Milter bindings
Documentation

Milter

Bindings for the libmilter (Sendmail mail filter) library.

This is a work in progress etc.

Design

As a Rust binding to an existing C API, there are some tradeoffs. This is a safe convenience binding. Overall it tries to stay relatively close to the underlying functions, and does not overly conceal what’s underneath. Keep things possible as in C.

A milter implementation is driven by the libmilter implementation itself. Documentation will speak of the ‘milter library’ in those cases.

Globals

A milter implementation is fundamentally a singleton within the process. Only one invocation of Milter::run is allowed per process. Therefore, globals are an acceptable and reasonable thing to have.

Safety

In the callback code panicking must be avoided. As callback code is executed through a foreign code layer, restrictions re FFI apply. Stack unwinding through an FFI boundary is undefined behaviour.

That is why Result is used pervasively.

Usage

Intended for creation of main.rs binaries. Signals are handled by the milter library, shut down with Ctrl-C.