Trait artichoke::prelude::RubyException
source · 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
.