Struct spinoso_exception::KeyError[][src]

pub struct KeyError { /* fields omitted */ }

Ruby KeyError error type.

Descendants of class Exception are used to communicate between Kernel#raise and rescue statements in begin ... end blocks. Exception objects carry information about the exception – its type (the exception’s class name), an optional descriptive string, and optional traceback information. Exception subclasses may add additional information like NameError#name.


impl KeyError[src]

#[must_use]pub const fn new() -> Self[src]

Construct a new, default KeyError Ruby exception.

This constructor sets the exception message to KeyError.


let exception = KeyError::new();
assert_eq!(exception.message(), b"KeyError");

#[must_use]pub const fn with_message(message: &'static str) -> Self[src]

Construct a new, KeyError Ruby exception with the given message.


let exception = KeyError::with_message("an error occurred");
assert_eq!(exception.message(), b"an error occurred");

#[must_use]pub fn message(&self) -> &[u8][src]

Return the message this Ruby exception was constructed with.


let exception = KeyError::new();
assert_eq!(exception.message(), b"KeyError");
let exception = KeyError::from("something went wrong");
assert_eq!(exception.message(), b"something went wrong");

#[must_use]pub const fn name(&self) -> &'static str[src]

Return this Ruby exception’s class name.


let exception = KeyError::new();
assert_eq!(, "KeyError");

Trait Implementations

impl Clone for KeyError[src]

impl Debug for KeyError[src]

impl Default for KeyError[src]

impl Display for KeyError[src]

impl Eq for KeyError[src]

impl Error for KeyError[src]

impl From<&'static [u8]> for KeyError[src]

impl From<&'static str> for KeyError[src]

impl From<Cow<'static, [u8]>> for KeyError[src]

impl From<Cow<'static, str>> for KeyError[src]

impl From<String> for KeyError[src]

impl From<Vec<u8, Global>> for KeyError[src]

impl Hash for KeyError[src]

impl Ord for KeyError[src]

impl PartialEq<KeyError> for KeyError[src]

impl PartialOrd<KeyError> for KeyError[src]

impl RubyException for KeyError[src]

impl StructuralEq for KeyError[src]

impl StructuralPartialEq for KeyError[src]

Auto Trait Implementations

impl RefUnwindSafe for KeyError

impl Send for KeyError

impl Sync for KeyError

impl Unpin for KeyError

impl UnwindSafe for KeyError

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.