pub struct CrashReporter(/* private fields */);Expand description
Cheap cloneable handle to the installed crash reporter.
Implementations§
Source§impl CrashReporter
impl CrashReporter
Sourcepub fn install(
options: CrashReporterOptions,
) -> Result<CrashReporter, SystemIntegrationError>
pub fn install( options: CrashReporterOptions, ) -> Result<CrashReporter, SystemIntegrationError>
Install the process-wide panic hook and, unless disabled, the native fatal-signal handler.
Installing twice is an error; use CrashReporter::current to reach the existing handle.
Sourcepub fn detached(
options: CrashReporterOptions,
) -> Result<CrashReporter, SystemIntegrationError>
pub fn detached( options: CrashReporterOptions, ) -> Result<CrashReporter, SystemIntegrationError>
Build a reporter that owns its directory but installs no process-wide hooks.
Deterministic tests and secondary tools use this to exercise writing, retention, parsing, and upload without changing global process state.
Sourcepub fn current() -> Option<CrashReporter>
pub fn current() -> Option<CrashReporter>
The installed reporter, when CrashReporter::install has already succeeded.
Sourcepub fn max_reports(&self) -> usize
pub fn max_reports(&self) -> usize
Configured retention count.
Sourcepub fn max_report_bytes(&self) -> usize
pub fn max_report_bytes(&self) -> usize
Configured per-report byte limit.
Sourcepub fn add_extra_parameter(
&self,
key: impl Into<String>,
value: impl Into<String>,
) -> Result<(), SystemIntegrationError>
pub fn add_extra_parameter( &self, key: impl Into<String>, value: impl Into<String>, ) -> Result<(), SystemIntegrationError>
Add or replace one bounded extra parameter recorded in later reports.
Sourcepub fn remove_extra_parameter(&self, key: &str) -> bool
pub fn remove_extra_parameter(&self, key: &str) -> bool
Remove one extra parameter, reporting whether it was present.
Sourcepub fn extra_parameters(&self) -> BTreeMap<String, String>
pub fn extra_parameters(&self) -> BTreeMap<String, String>
A snapshot of the retained extra parameters.
Sourcepub fn capture_report(
&self,
report: &CrashReport,
) -> Result<PathBuf, SystemIntegrationError>
pub fn capture_report( &self, report: &CrashReport, ) -> Result<PathBuf, SystemIntegrationError>
Write one caller-built report atomically and apply retention.
Sourcepub fn last_crash_report(
&self,
) -> Result<Option<CrashReport>, SystemIntegrationError>
pub fn last_crash_report( &self, ) -> Result<Option<CrashReport>, SystemIntegrationError>
The newest retained report, parsed from disk.
Sourcepub fn pending_reports(
&self,
) -> Result<Vec<CrashReport>, SystemIntegrationError>
pub fn pending_reports( &self, ) -> Result<Vec<CrashReport>, SystemIntegrationError>
Every retained report in oldest-to-newest order, bounded by the configured retention.
Sourcepub fn delete_report(&self, id: &str) -> Result<bool, SystemIntegrationError>
pub fn delete_report(&self, id: &str) -> Result<bool, SystemIntegrationError>
Delete one retained report by identifier, reporting whether it existed.
Sourcepub fn upload_endpoint(&self) -> Option<&str>
pub fn upload_endpoint(&self) -> Option<&str>
The endpoint configured through CrashReporterOptions::upload_endpoint.
Sourcepub fn upload_body(
report: &CrashReport,
) -> Result<Vec<u8>, SystemIntegrationError>
pub fn upload_body( report: &CrashReport, ) -> Result<Vec<u8>, SystemIntegrationError>
Build the exact JSON body one upload sends for a report.
Sourcepub fn upload_pending(
&self,
endpoint: &str,
) -> Result<UploadSummary, SystemIntegrationError>
pub fn upload_pending( &self, endpoint: &str, ) -> Result<UploadSummary, SystemIntegrationError>
POST every retained report to endpoint, deleting the ones the endpoint accepts.
At most MAX_CRASH_UPLOAD_REPORTS reports are sent per call. Reports the endpoint
rejects stay on disk for the next attempt.
Sourcepub fn build_report(
&self,
kind: CrashKind,
message: impl Into<String>,
) -> CrashReport
pub fn build_report( &self, kind: CrashKind, message: impl Into<String>, ) -> CrashReport
Build a report for the current process using the reporter’s identity and parameters.
Trait Implementations§
Source§impl Clone for CrashReporter
impl Clone for CrashReporter
Source§fn clone(&self) -> CrashReporter
fn clone(&self) -> CrashReporter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CrashReporter
impl RefUnwindSafe for CrashReporter
impl Send for CrashReporter
impl Sync for CrashReporter
impl Unpin for CrashReporter
impl UnsafeUnpin for CrashReporter
impl UnwindSafe for CrashReporter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.