pub struct Report {
pub report_id: Option<Uuid>,
pub timestamp: Option<String>,
pub generated_by: Option<String>,
pub extra: HashMap<String, Value>,
/* private fields */
}
Expand description
Top-level element for a CTRF report. Corresponds to the spec’s “Root” object.
Fields§
§report_id: Option<Uuid>
§timestamp: Option<String>
§generated_by: Option<String>
§extra: HashMap<String, Value>
Implementations§
Source§impl Report
impl Report
Sourcepub fn new(
report_id: Option<Uuid>,
timestamp: Option<SystemTime>,
generated_by: Option<String>,
results: Results,
) -> Self
pub fn new( report_id: Option<Uuid>, timestamp: Option<SystemTime>, generated_by: Option<String>, results: Results, ) -> Self
Creates an instance of a CTRF report
Sourcepub fn from_slice(s: &[u8]) -> Result<Self>
pub fn from_slice(s: &[u8]) -> Result<Self>
Deserialize a Report
instance from bytes of JSON text
Sourcepub fn from_value(v: Value) -> Result<Self>
pub fn from_value(v: Value) -> Result<Self>
Interpret a serde_json::Value
as a Report
instance
Sourcepub fn from_reader(r: impl Read) -> Result<Self>
pub fn from_reader(r: impl Read) -> Result<Self>
Deserialize a Report
instance from an I/O stream of JSON text
Sourcepub fn to_string_pretty(&self) -> Result<String>
pub fn to_string_pretty(&self) -> Result<String>
Outputs the report as a pretty-printed String of JSON
Sourcepub fn to_vec_pretty(&self) -> Result<Vec<u8>>
pub fn to_vec_pretty(&self) -> Result<Vec<u8>>
Outputs the report as a pretty-printed JSON byte vector
Sourcepub fn to_writer(&self, writer: impl Write) -> Result<()>
pub fn to_writer(&self, writer: impl Write) -> Result<()>
Outputs the report as JSON to the provided I/O stream
Sourcepub fn to_writer_pretty(&self, writer: impl Write) -> Result<()>
pub fn to_writer_pretty(&self, writer: impl Write) -> Result<()>
Outputs the report as pretty-printed JSON to the provided I/O stream
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Report
impl<'de> Deserialize<'de> for Report
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Extra for Report
impl Extra for Report
impl StructuralPartialEq for Report
Auto Trait Implementations§
impl Freeze for Report
impl RefUnwindSafe for Report
impl Send for Report
impl Sync for Report
impl Unpin for Report
impl UnwindSafe for Report
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