Struct milter::Context[][src]

pub struct Context<T> {
    pub api: ContextApi,
    pub data: DataHandle<T>,
}
Expand description

Context supplied to the milter callbacks.

The Context<T> struct provides access to the context API via its api field. It also provides access to connection-local user data, the type of which is T.

Safety

The type parameter T specifies the type of the value to be retrieved from the data handle. Retrieval of the data uses unsafe code, as the data needs to be materialised from a raw C pointer. Take care not to introduce a mismatch when specifying T; T must always be the same type over the whole callback flow.

Fields

api: ContextApi

An accessor to the API methods operating on this context.

data: DataHandle<T>

A handle on user data associated with this context.

Implementations

Constructs a new Context from the libmilter-supplied raw context pointer.

You do not normally need to use new; a Context is already supplied to the callbacks.

Panics

Panics if ptr is null.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.