[][src]Struct milter::Context

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

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. Retrieving the data is potentially an unsafe operation, as the data needs to be materialised from a raw C pointer. Take care not to introduce a mismatch when specifying T; T should 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.

Methods

impl<T> Context<T>[src]

pub fn new(ptr: *mut SMFICTX) -> Self[src]

Constructs a new Context from the milter library-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

impl<T: Debug> Debug for Context<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Context<T> where
    T: RefUnwindSafe

impl<T> !Send for Context<T>

impl<T> !Sync for Context<T>

impl<T> Unpin for Context<T>

impl<T> UnwindSafe for Context<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.