Struct spinoso_exception::TypeError[][src]

pub struct TypeError { /* fields omitted */ }

Ruby TypeError 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 TypeError[src]

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

Construct a new, default TypeError Ruby exception.

This constructor sets the exception message to TypeError.


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

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

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


let exception = TypeError::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 = TypeError::new();
assert_eq!(exception.message(), b"TypeError");
let exception = TypeError::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 = TypeError::new();
assert_eq!(, "TypeError");

Trait Implementations

impl Clone for TypeError[src]

impl Debug for TypeError[src]

impl Default for TypeError[src]

impl Display for TypeError[src]

impl Eq for TypeError[src]

impl Error for TypeError[src]

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

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

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

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

impl From<String> for TypeError[src]

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

impl Hash for TypeError[src]

impl Ord for TypeError[src]

impl PartialEq<TypeError> for TypeError[src]

impl PartialOrd<TypeError> for TypeError[src]

impl RubyException for TypeError[src]

impl StructuralEq for TypeError[src]

impl StructuralPartialEq for TypeError[src]

Auto Trait Implementations

impl RefUnwindSafe for TypeError

impl Send for TypeError

impl Sync for TypeError

impl Unpin for TypeError

impl UnwindSafe for TypeError

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.