pub struct ThreadError { /* private fields */ }
Expand description
Ruby ThreadError
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
.
Implementations§
Source§impl ThreadError
impl ThreadError
Sourcepub const fn new() -> ThreadError
pub const fn new() -> ThreadError
Construct a new, default ThreadError
Ruby exception.
This constructor sets the exception message to ThreadError
.
§Examples
let exception = ThreadError::new();
assert_eq!(exception.message(), b"ThreadError");
Sourcepub const fn with_message(message: &'static str) -> ThreadError
pub const fn with_message(message: &'static str) -> ThreadError
Construct a new, ThreadError
Ruby exception with the given
message.
§Examples
let exception = ThreadError::with_message("an error occurred");
assert_eq!(exception.message(), b"an error occurred");
Sourcepub fn message(&self) -> &[u8] ⓘ
pub fn message(&self) -> &[u8] ⓘ
Return the message this Ruby exception was constructed with.
§Examples
let exception = ThreadError::new();
assert_eq!(exception.message(), b"ThreadError");
let exception = ThreadError::from("something went wrong");
assert_eq!(exception.message(), b"something went wrong");
Trait Implementations§
Source§impl Clone for ThreadError
impl Clone for ThreadError
Source§fn clone(&self) -> ThreadError
fn clone(&self) -> ThreadError
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ThreadError
impl Debug for ThreadError
Source§impl Default for ThreadError
impl Default for ThreadError
Source§fn default() -> ThreadError
fn default() -> ThreadError
Returns the “default value” for a type. Read more
Source§impl Display for ThreadError
impl Display for ThreadError
Source§impl Error for ThreadError
impl Error for ThreadError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<&'static [u8]> for ThreadError
impl From<&'static [u8]> for ThreadError
Source§fn from(message: &'static [u8]) -> ThreadError
fn from(message: &'static [u8]) -> ThreadError
Converts to this type from the input type.
Source§impl From<&'static str> for ThreadError
impl From<&'static str> for ThreadError
Source§fn from(message: &'static str) -> ThreadError
fn from(message: &'static str) -> ThreadError
Converts to this type from the input type.
Source§impl From<String> for ThreadError
impl From<String> for ThreadError
Source§fn from(message: String) -> ThreadError
fn from(message: String) -> ThreadError
Converts to this type from the input type.
Source§impl From<ThreadError> for Error
impl From<ThreadError> for Error
Source§fn from(exception: ThreadError) -> Error
fn from(exception: ThreadError) -> Error
Converts to this type from the input type.
Source§impl Hash for ThreadError
impl Hash for ThreadError
Source§impl Ord for ThreadError
impl Ord for ThreadError
Source§fn cmp(&self, other: &ThreadError) -> Ordering
fn cmp(&self, other: &ThreadError) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ThreadError
impl PartialEq for ThreadError
Source§impl PartialOrd for ThreadError
impl PartialOrd for ThreadError
Source§impl RubyException for ThreadError
impl RubyException for ThreadError
Source§impl RubyException for ThreadError
impl RubyException for ThreadError
Source§fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>
fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>
Optional backtrace specified by a
Vec
of frames.Source§fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>
fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>
Return a raise-able
sys::mrb_value
.impl Eq for ThreadError
impl StructuralPartialEq for ThreadError
Auto Trait Implementations§
impl Freeze for ThreadError
impl RefUnwindSafe for ThreadError
impl Send for ThreadError
impl Sync for ThreadError
impl Unpin for ThreadError
impl UnwindSafe for ThreadError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more