pub struct ZeroDivisionError { /* private fields */ }
Expand description
Ruby ZeroDivisionError
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 ZeroDivisionError
impl ZeroDivisionError
Sourcepub const fn new() -> ZeroDivisionError
pub const fn new() -> ZeroDivisionError
Construct a new, default ZeroDivisionError
Ruby exception.
This constructor sets the exception message to ZeroDivisionError
.
§Examples
let exception = ZeroDivisionError::new();
assert_eq!(exception.message(), b"ZeroDivisionError");
Sourcepub const fn with_message(message: &'static str) -> ZeroDivisionError
pub const fn with_message(message: &'static str) -> ZeroDivisionError
Construct a new, ZeroDivisionError
Ruby exception with the given
message.
§Examples
let exception = ZeroDivisionError::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 = ZeroDivisionError::new();
assert_eq!(exception.message(), b"ZeroDivisionError");
let exception = ZeroDivisionError::from("something went wrong");
assert_eq!(exception.message(), b"something went wrong");
Trait Implementations§
Source§impl Clone for ZeroDivisionError
impl Clone for ZeroDivisionError
Source§fn clone(&self) -> ZeroDivisionError
fn clone(&self) -> ZeroDivisionError
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 ZeroDivisionError
impl Debug for ZeroDivisionError
Source§impl Default for ZeroDivisionError
impl Default for ZeroDivisionError
Source§fn default() -> ZeroDivisionError
fn default() -> ZeroDivisionError
Returns the “default value” for a type. Read more
Source§impl Display for ZeroDivisionError
impl Display for ZeroDivisionError
Source§impl Error for ZeroDivisionError
impl Error for ZeroDivisionError
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 ZeroDivisionError
impl From<&'static [u8]> for ZeroDivisionError
Source§fn from(message: &'static [u8]) -> ZeroDivisionError
fn from(message: &'static [u8]) -> ZeroDivisionError
Converts to this type from the input type.
Source§impl From<&'static str> for ZeroDivisionError
impl From<&'static str> for ZeroDivisionError
Source§fn from(message: &'static str) -> ZeroDivisionError
fn from(message: &'static str) -> ZeroDivisionError
Converts to this type from the input type.
Source§impl From<String> for ZeroDivisionError
impl From<String> for ZeroDivisionError
Source§fn from(message: String) -> ZeroDivisionError
fn from(message: String) -> ZeroDivisionError
Converts to this type from the input type.
Source§impl From<ZeroDivisionError> for Error
impl From<ZeroDivisionError> for Error
Source§fn from(exception: ZeroDivisionError) -> Error
fn from(exception: ZeroDivisionError) -> Error
Converts to this type from the input type.
Source§impl Hash for ZeroDivisionError
impl Hash for ZeroDivisionError
Source§impl Ord for ZeroDivisionError
impl Ord for ZeroDivisionError
Source§fn cmp(&self, other: &ZeroDivisionError) -> Ordering
fn cmp(&self, other: &ZeroDivisionError) -> 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 ZeroDivisionError
impl PartialEq for ZeroDivisionError
Source§impl PartialOrd for ZeroDivisionError
impl PartialOrd for ZeroDivisionError
Source§impl RubyException for ZeroDivisionError
impl RubyException for ZeroDivisionError
Source§impl RubyException for ZeroDivisionError
impl RubyException for ZeroDivisionError
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 ZeroDivisionError
impl StructuralPartialEq for ZeroDivisionError
Auto Trait Implementations§
impl Freeze for ZeroDivisionError
impl RefUnwindSafe for ZeroDivisionError
impl Send for ZeroDivisionError
impl Sync for ZeroDivisionError
impl Unpin for ZeroDivisionError
impl UnwindSafe for ZeroDivisionError
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