Skip to main content

ReportBuilder

Struct ReportBuilder 

Source
pub struct ReportBuilder {
    report: Report,
    pending_labels: Vec<String>,
}
Expand description

Fluent builder for a Report. Finalise with ReportBuilder::build.

Fields§

§report: Report§pending_labels: Vec<String>

Implementations§

Source§

impl ReportBuilder

Source

pub fn new( plugin_id: impl Into<String>, plugin_version: impl Into<String>, ) -> Self

Start a new report for a plugin. id and version typically come from env!("CARGO_PKG_NAME") / env!("CARGO_PKG_VERSION").

Source

pub fn display_name(self, name: impl Into<String>) -> Self

Set a human-friendly plugin name for the frontend (e.g. "YARA Scanner").

Source

pub fn summary(self, summary: impl Into<String>) -> Self

Set a short summary shown at the top of the report.

Source

pub fn verdict( self, classification: Classification, score: Option<u8>, confidence: Option<Confidence>, ) -> Self

Set the verdict. score is optional (pass None when the plugin has no numeric score). Can be called before or after labels.

Source

pub fn labels<I, S>(self, labels: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Append labels to the verdict. Can be called before or after verdict - labels are merged at build time.

Source

pub fn indicator(self, ind: Indicator) -> Self

Add an indicator of compromise to the report’s semantic layer.

Source

pub fn ttp(self, ttp: Ttp) -> Self

Add a MITRE ATT&CK technique observation.

Source

pub fn artifact(self, artifact: ArtifactRef) -> Self

Register a sibling PluginResult as an artifact.

Source

pub fn section<F>( self, id: impl Into<String>, title: impl Into<String>, build: F, ) -> Self

Append a section. The closure receives a SectionBuilder and returns it - the typical shape is |s| s.heading(2, "...").table(...).

Source

pub fn raw(self, value: impl Serialize) -> Self

Attach the plugin’s native JSON as an escape hatch. Rarely needed - prefer typed blocks.

Source

pub fn build(self) -> Report

Finalize and return the Report. Merges any pending labels into the verdict.

Auto Trait Implementations§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more