[][src]Enum milter::Error

pub enum Error {
    SocketConfig(CString),
    TimeoutConfig(i32),
    SocketBacklogConfig(i32),
    Registration,
    Main,
    CallbackPanic,
    FailureStatus,
    FfiCString(NulError),
    FfiInt(TryFromIntError),
    FfiUtf8(Utf8Error),
    DataAccess(BorrowError),
    DataAccessMut(BorrowMutError),
    Custom(Box<dyn Error + Send + Sync>),
}

Various kinds of errors that can occur in a milter application.

Variants

SocketConfig(CString)

The socket specification provided to the Milter could not be used.

TimeoutConfig(i32)

The timeout duration configuration parameter of the Milter is invalid.

SocketBacklogConfig(i32)

The socket backlog length configuration parameter of the Milter is invalid.

Registration

Registration of the milter’s configuration with the milter library failed.

Main

The milter library’s event loop (main function) exited with a failure status.

CallbackPanic

The milter library’s event loop was shut down after a panic in a callback.

FailureStatus

A milter library function returned the failure status code.

FfiCString(NulError)

Conversion to a C-style string at the FFI boundary (Rust/C) failed, with cause attached.

Conversion to an integer type at the FFI boundary (Rust/C) failed, with cause attached.

FfiUtf8(Utf8Error)

Conversion to a UTF-8 string at the FFI boundary (Rust/C) failed, with cause attached.

DataAccess(BorrowError)

Erroneous immutable access of context data (violation of dynamic borrowing rules), with cause attached.

DataAccessMut(BorrowMutError)

Erroneous mutable access of context data (violation of dynamic borrowing rules), with cause attached.

Custom(Box<dyn Error + Send + Sync>)

An unspecific error variant, with cause attached.

Examples

This variant is provided as a convenience; use it to propagate arbitrary errors out of a callback.

use milter::{Context, Error, Status};
use std::fs::File;

fn handle_data(context: Context<()>) -> milter::Result<Status> {
    let _ = File::create("/tmp/archive").map_err(|e| Error::Custom(e.into()))?;

    Ok(Status::Continue)
}

Trait Implementations

impl From<NulError> for Error[src]

impl From<TryFromIntError> for Error[src]

impl From<Utf8Error> for Error[src]

impl From<BorrowError> for Error[src]

impl From<BorrowMutError> for Error[src]

impl From<Box<dyn Error + 'static + Sync + Send>> for Error[src]

impl Display for Error[src]

impl Debug for Error[src]

impl Error for Error[src]

Auto Trait Implementations

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl !UnwindSafe for Error

impl !RefUnwindSafe for Error

Blanket Implementations

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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]