pub struct VmError { /* private fields */ }Expand description
Implementations§
Source§impl VmError
impl VmError
Sourcepub fn new(kind: VmErrorKind) -> Self
pub fn new(kind: VmErrorKind) -> Self
Creates a typed runtime error, for example from a Rust callback.
A script-thrown object has no transferable identity in Rust. Returning a
captured GuestError from a callback raises
its original message as a string, including after reset or in another VM.
Sourcepub fn kind(&self) -> &VmErrorKind
pub fn kind(&self) -> &VmErrorKind
Returns the failure category without parsing its message.
Sourcepub fn message(&self) -> VmErrorMessage<'_>
pub fn message(&self) -> VmErrorMessage<'_>
Returns the original message without a source-location prefix.
Sourcepub fn source_location(&self) -> Option<SourceLocation<'_>>
pub fn source_location(&self) -> Option<SourceLocation<'_>>
Returns the source label and one-based line, when available.
Sourcepub fn source_span(&self) -> Option<SourceSpan>
pub fn source_span(&self) -> Option<SourceSpan>
Returns the source byte range, when available.
Sourcepub fn without_source_location(self) -> Self
pub fn without_source_location(self) -> Self
Omits a source prefix from this failure’s short message.
Host-side reports may still identify the script that called a callback.
Trait Implementations§
Source§impl Error for VmError
impl Error for VmError
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()
Auto Trait Implementations§
impl Freeze for VmError
impl !RefUnwindSafe for VmError
impl Send for VmError
impl Sync for VmError
impl Unpin for VmError
impl UnsafeUnpin for VmError
impl !UnwindSafe for VmError
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