[][src]Struct milter::Context

pub struct Context<T> {
    pub data: DataHandle<T>,
    // some fields omitted
}

Context supplied to the milter callbacks.

The context also provides access to connection or message data.

Safety

The type parameter T determines the type of the value to be retrieved from the data handle. In one milter application this type should always be the same type across callbacks. Specifying a mismatched type is not safe.

Fields

data: DataHandle<T>

A handle on 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 this method; a Context is already supplied to the callbacks.

Panics

Panics if ptr is null.

pub fn macro_value(&self, name: &str) -> Result<Option<&str>>[src]

Returns the value for the given macro, if present.

Errors

If conversion of arguments or return values at the boundary to the milter library fails, an error variant is returned.

Examples

let ip_address = context.macro_value("{daemon_addr}")?;

pub fn set_requested_macros(&self, stage: Stage, macros: &str) -> Result<()>[src]

Requests the given macros to be made available in the given stage.

Macro requirements should be handled during negotiation.

pub fn set_error_reply(
    &self,
    code: &str,
    ext_code: Option<&str>,
    msg_lines: Vec<&str>
) -> Result<()>
[src]

Sets the default SMTP (and ESMTP) error reply code and message.

Trait Implementations

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

Auto Trait Implementations

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

impl<T> !RefUnwindSafe for Context<T>

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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