Skip to content

Commit

Permalink
Add missing documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
passy authored and spacekookie committed Jun 15, 2019
1 parent 656bc9d commit 200e427
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/report.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//! This module encapsulates the report of a failure event.
//!
//! A `Report` contains the metadata collected about the event
//! to construct a helpful error message.

extern crate failure;
extern crate os_type;
extern crate serde;
Expand All @@ -16,9 +21,14 @@ use std::{env, fs::File, io::Write, path::Path, path::PathBuf};
/// Method of failure.
#[derive(Debug, Serialize, Clone, Copy)]
pub enum Method {
/// Failure caused by a panic.
Panic,
}

/// Contains metadata about the crash like the backtrace and
/// information about the crate and operating system. Can
/// be used to be serialized and persisted or printed as
/// information to the user.
#[derive(Debug, Serialize)]
pub struct Report {
name: String,
Expand Down Expand Up @@ -119,6 +129,7 @@ impl Report {
}
}

/// Serialize the `Report` to a TOML string.
pub fn serialize(&self) -> Option<String> {
toml::to_string_pretty(&self).ok()
}
Expand Down

0 comments on commit 200e427

Please sign in to comment.