pub struct PerlError {
pub kind: ErrorKind,
pub message: String,
pub line: usize,
pub file: String,
pub die_value: Option<PerlValue>,
pub near: Option<String>,
}Fields§
§kind: ErrorKind§message: String§line: usize§file: String§die_value: Option<PerlValue>When die is called with a ref argument, the original value is preserved here
so that $@ can hold the ref (not just its stringification).
near: Option<String>For Syntax errors, optional suffix shown after at -e line N. Perl
emits , near "TOKEN" or , at EOF depending on where the parse
failed; absent (None) yields the standard period-terminated form.
Implementations§
Source§impl PerlError
impl PerlError
pub fn new( kind: ErrorKind, message: impl Into<String>, line: usize, file: impl Into<String>, ) -> Self
Sourcepub fn with_near(self, near: impl Into<String>) -> Self
pub fn with_near(self, near: impl Into<String>) -> Self
Attach a , near "..." or , at EOF suffix used by Perl’s
compile-error formatter. Only takes effect for ErrorKind::Syntax.
pub fn syntax(message: impl Into<String>, line: usize) -> Self
pub fn runtime(message: impl Into<String>, line: usize) -> Self
pub fn type_error(message: impl Into<String>, line: usize) -> Self
Sourcepub fn at_line(self, line: usize) -> Self
pub fn at_line(self, line: usize) -> Self
Replace line number (e.g. map VM op line onto an error).
pub fn die(message: impl Into<String>, line: usize) -> Self
Sourcepub fn division_by_zero(message: impl Into<String>, line: usize) -> Self
pub fn division_by_zero(message: impl Into<String>, line: usize) -> Self
Constructor for division-by-zero errors. The user-visible message
and Display formatting are unchanged from runtime(...); only the
kind differs, so callers (try/catch, error filters) can match
ErrorKind::DivisionByZero specifically.
pub fn die_with_value(value: PerlValue, message: String, line: usize) -> Self
Trait Implementations§
Source§impl Error for PerlError
impl Error for PerlError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for PerlError
impl RefUnwindSafe for PerlError
impl Send for PerlError
impl Sync for PerlError
impl Unpin for PerlError
impl UnsafeUnpin for PerlError
impl UnwindSafe for PerlError
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.