pub struct ReportGenerator;Expand description
Report generator Phase 1: Basic YAML output generation
Implementations§
Source§impl ReportGenerator
impl ReportGenerator
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new report generator
§Examples
use organizational_intelligence_plugin::report::ReportGenerator;
let generator = ReportGenerator::new();Sourcepub fn to_yaml(&self, report: &AnalysisReport) -> Result<String>
pub fn to_yaml(&self, report: &AnalysisReport) -> Result<String>
Convert report to YAML string
§Arguments
report- The analysis report to serialize
§Errors
Returns error if serialization fails
§Examples
use organizational_intelligence_plugin::report::{
ReportGenerator, AnalysisReport, AnalysisMetadata
};
let generator = ReportGenerator::new();
let metadata = AnalysisMetadata {
organization: "test-org".to_string(),
analysis_date: "2025-11-15T00:00:00Z".to_string(),
repositories_analyzed: 10,
commits_analyzed: 100,
analyzer_version: "0.1.0".to_string(),
};
let report = AnalysisReport {
version: "1.0".to_string(),
metadata,
defect_patterns: vec![],
};
let yaml = generator.to_yaml(&report).expect("Should serialize");
assert!(yaml.contains("version"));Sourcepub async fn write_to_file(
&self,
report: &AnalysisReport,
path: &Path,
) -> Result<()>
pub async fn write_to_file( &self, report: &AnalysisReport, path: &Path, ) -> Result<()>
Write report to file
§Arguments
report- The analysis report to writepath- Path to output file
§Errors
Returns error if:
- Serialization fails
- File write fails
- Path is invalid
§Examples
use organizational_intelligence_plugin::report::{
ReportGenerator, AnalysisReport, AnalysisMetadata
};
use std::path::PathBuf;
let generator = ReportGenerator::new();
let metadata = AnalysisMetadata {
organization: "test-org".to_string(),
analysis_date: "2025-11-15T00:00:00Z".to_string(),
repositories_analyzed: 10,
commits_analyzed: 100,
analyzer_version: "0.1.0".to_string(),
};
let report = AnalysisReport {
version: "1.0".to_string(),
metadata,
defect_patterns: vec![],
};
generator.write_to_file(&report, &PathBuf::from("report.yaml")).await?;Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReportGenerator
impl RefUnwindSafe for ReportGenerator
impl Send for ReportGenerator
impl Sync for ReportGenerator
impl Unpin for ReportGenerator
impl UnwindSafe for ReportGenerator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more