[][src]Enum pir_8_emu::vm::PortHandlerInstallError

pub enum PortHandlerInstallError {
    PortsTaken(Vec<u8>),
    WrongPortCount(usizeu8),
    TooManyHandlers,
}

An error that could've occurred when installing a port handler.

Examples

struct NopHandler;
impl PortHandler for NopHandler {
    fn port_count(&self) -> NonZeroU8 { NonZeroU8::new(3).unwrap() }
}

let mut ports = Ports::new();
assert_eq!(ports.install_handler(NopHandler, &[0, 1]),
           Err((NopHandler, PortHandlerInstallError::WrongPortCount(2, 3))));

ports.install_handler(NopHandler, &[0, 1, 2]).unwrap();

assert_eq!(ports.install_handler(NopHandler, &[1, 2, 3]),
           Err((NopHandler, PortHandlerInstallError::PortsTaken(vec![1, 2]))));

Variants

PortsTaken(Vec<u8>)

The specified ports were already taken by some other handler

WrongPortCount(usizeu8)

The specified port count was specified, but the handler takes only the specified amount of ports

TooManyHandlers

Installing this handler would overflow

Trait Implementations

impl Clone for PortHandlerInstallError[src]

impl Debug for PortHandlerInstallError[src]

impl Display for PortHandlerInstallError[src]

impl Eq for PortHandlerInstallError[src]

impl Error for PortHandlerInstallError[src]

impl Hash for PortHandlerInstallError[src]

impl Ord for PortHandlerInstallError[src]

impl PartialEq<PortHandlerInstallError> for PortHandlerInstallError[src]

impl PartialOrd<PortHandlerInstallError> for PortHandlerInstallError[src]

impl StructuralEq for PortHandlerInstallError[src]

impl StructuralPartialEq for PortHandlerInstallError[src]

Auto Trait Implementations

impl RefUnwindSafe for PortHandlerInstallError

impl Send for PortHandlerInstallError

impl Sync for PortHandlerInstallError

impl Unpin for PortHandlerInstallError

impl UnwindSafe for PortHandlerInstallError

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> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.