Struct Report

Source
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

Source

pub fn new( report_id: Option<Uuid>, timestamp: Option<SystemTime>, generated_by: Option<String>, results: Results, ) -> Self

Creates an instance of a CTRF report

Source

pub fn from_slice(s: &[u8]) -> Result<Self>

Deserialize a Report instance from bytes of JSON text

Source

pub fn from_value(v: Value) -> Result<Self>

Interpret a serde_json::Value as a Report instance

Source

pub fn from_reader(r: impl Read) -> Result<Self>

Deserialize a Report instance from an I/O stream of JSON text

Source

pub fn results(&self) -> &Results

Borrows the contained Results

Source

pub fn to_string(&self) -> Result<String>

Outputs the report as a String of JSON

Source

pub fn to_string_pretty(&self) -> Result<String>

Outputs the report as a pretty-printed String of JSON

Source

pub fn to_vec(&self) -> Result<Vec<u8>>

Outputs the report as a JSON byte vector

Source

pub fn to_vec_pretty(&self) -> Result<Vec<u8>>

Outputs the report as a pretty-printed JSON byte vector

Source

pub fn to_writer(&self, writer: impl Write) -> Result<()>

Outputs the report as JSON to the provided I/O stream

Source

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 Debug for Report

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Report

Source§

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

Source§

fn insert_extra(&mut self, key: String, value: Value) -> Option<Value>

Inserts an element into the Extra map. Returns the value that it replaced, if one was present, or None if not.

Source§

fn remove_extra(&mut self, key: &str) -> Option<Value>

Removes the value at the provided key. Returns the value if one was present, or None if not.

Source§

impl FromStr for Report

Source§

fn from_str(s: &str) -> Result<Self>

Deserialize a Report instance from a string of JSON text

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl PartialEq for Report

Source§

fn eq(&self, other: &Report) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Report

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,