Struct proguard::StackTrace
source · pub struct StackTrace<'s> { /* private fields */ }
Expand description
A full Java StackTrace as printed by Throwable.printStackTrace()
.
Implementations§
source§impl<'s> StackTrace<'s>
impl<'s> StackTrace<'s>
sourcepub fn new(
exception: Option<Throwable<'s>>,
frames: Vec<StackFrame<'s>>
) -> Self
pub fn new( exception: Option<Throwable<'s>>, frames: Vec<StackFrame<'s>> ) -> Self
Create a new StackTrace.
sourcepub fn with_cause(
exception: Option<Throwable<'s>>,
frames: Vec<StackFrame<'s>>,
cause: StackTrace<'s>
) -> Self
pub fn with_cause( exception: Option<Throwable<'s>>, frames: Vec<StackFrame<'s>>, cause: StackTrace<'s> ) -> Self
Create a new StackTrace with cause information.
sourcepub fn try_parse(stacktrace: &'s [u8]) -> Option<Self>
pub fn try_parse(stacktrace: &'s [u8]) -> Option<Self>
Parses a StackTrace from a full Java StackTrace.
Examples
use proguard::{StackFrame, StackTrace, Throwable};
let stacktrace = "\
some.CustomException: Crashed!
at some.Klass.method(Klass.java:1234)
Caused by: some.InnerException
at some.Klass2.method2(Klass2.java:5678)
";
let parsed = StackTrace::try_parse(stacktrace.as_bytes());
assert_eq!(
parsed,
Some(StackTrace::with_cause(
Some(Throwable::with_message("some.CustomException", "Crashed!")),
vec![StackFrame::with_file(
"some.Klass",
"method",
1234,
"Klass.java",
)],
StackTrace::new(
Some(Throwable::new("some.InnerException")),
vec![StackFrame::with_file(
"some.Klass2",
"method2",
5678,
"Klass2.java",
)]
)
))
);
sourcepub fn exception(&self) -> Option<&Throwable<'_>>
pub fn exception(&self) -> Option<&Throwable<'_>>
The exception at the top of the StackTrace, if present.
sourcepub fn frames(&self) -> &[StackFrame<'_>]
pub fn frames(&self) -> &[StackFrame<'_>]
All StackFrames following the exception.
sourcepub fn cause(&self) -> Option<&StackTrace<'_>>
pub fn cause(&self) -> Option<&StackTrace<'_>>
An optional cause describing the inner exception.
Trait Implementations§
source§impl<'s> Clone for StackTrace<'s>
impl<'s> Clone for StackTrace<'s>
source§fn clone(&self) -> StackTrace<'s>
fn clone(&self) -> StackTrace<'s>
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<'s> Debug for StackTrace<'s>
impl<'s> Debug for StackTrace<'s>
source§impl<'s> Display for StackTrace<'s>
impl<'s> Display for StackTrace<'s>
source§impl<'s> PartialEq<StackTrace<'s>> for StackTrace<'s>
impl<'s> PartialEq<StackTrace<'s>> for StackTrace<'s>
source§fn eq(&self, other: &StackTrace<'s>) -> bool
fn eq(&self, other: &StackTrace<'s>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.