[−][src]Struct milter::Context
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]
&self,
code: &str,
ext_code: Option<&str>,
msg_lines: Vec<&str>
) -> Result<()>
Sets the default SMTP (and ESMTP) error reply code and message.
Trait Implementations
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,
T: RefUnwindSafe,
impl<T> !RefUnwindSafe for Context<T>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,