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