pub trait RubyException: Error + 'static {
// Required methods
fn message(&self) -> Cow<'_, [u8]>;
fn name(&self) -> Cow<'_, str>;
fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>;
fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>;
}
Expand description
Polymorphic exception type that corresponds to Ruby’s Exception
.
All types that implement RubyException
can be raised with
error::raise
. Rust code can re-raise a trait object to
propagate exceptions from native code back into the interpreter.
Required Methods§
Sourcefn message(&self) -> Cow<'_, [u8]>
fn message(&self) -> Cow<'_, [u8]>
Message of the Exception
.
This value is a byte slice since Ruby String
s are equivalent to
Vec<u8>
.
Sourcefn 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.
Sourcefn 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
.
Trait Implementations§
Source§impl RubyException for Box<dyn RubyException>
impl RubyException for Box<dyn RubyException>
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
.