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