sarif_rust 0.3.0

A comprehensive Rust library for parsing, generating, and manipulating SARIF (Static Analysis Results Interchange Format) v2.1.0 files
Documentation
//! # SARIF Rust Library
//!
//! A comprehensive Rust library for parsing, generating, and manipulating
//! SARIF (Static Analysis Results Interchange Format) v2.1.0 files.
//!
//! SARIF is a standard JSON format for the output of static analysis tools.
//! This library provides complete support for the SARIF v2.1.0 specification
//! with type-safe parsing, generation, validation, and manipulation capabilities.
//!
//! ## Features
//!
//! - **Complete SARIF v2.1.0 Support**: Full specification compliance with all optional fields
//! - **Type-Safe API**: Leverages Rust's type system for correctness and safety
//! - **Builder Pattern**: Ergonomic API for programmatic SARIF generation
//! - **Advanced Querying**: Powerful filtering and search capabilities
//! - **Merge & Diff**: Combine multiple SARIF files or compare them
//! - **Multiple Formats**: Export to CSV, HTML, GitHub Security Advisory format
//! - **High Performance**: Streaming parser for large files with memory efficiency
//! - **Comprehensive Validation**: Multiple validation levels from minimal to pedantic
//! - **Schema Evolution**: Automatic migration between SARIF versions
//!
//! ## Quick Start
//!
//! ### Parsing SARIF Files
//!
//! ```rust,no_run
//! use sarif_rust::SarifLog;
//!
//! // Parse from file
//! let sarif: SarifLog = sarif_rust::from_file("results.sarif")?;
//!
//! // Parse from string
//! let json_content = std::fs::read_to_string("results.sarif")?;
//! let sarif: SarifLog = sarif_rust::from_str(&json_content)?;
//!
//! // Access results
//! for run in &sarif.runs {
//!     println!("Tool: {}", run.tool.driver.name);
//!     if let Some(results) = &run.results {
//!         for result in results {
//!             println!("  Issue: {}",
//!                 result.message.text.as_deref().unwrap_or("no message"));
//!         }
//!     }
//! }
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! ### Building SARIF Files
//!
//! ```rust
//! use sarif_rust::SarifLogBuilder;
//!
//! // Create a basic SARIF log
//! let sarif = SarifLogBuilder::new()
//!     .with_schema("https://json.schemastore.org/sarif-2.1.0.json")
//!     .build_unchecked(); // Note: use build()? for validation
//!
//! // Convert to JSON
//! let json = sarif_rust::to_string_pretty(&sarif)?;
//! println!("{}", json);
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! ## Error Handling
//!
//! All operations return `Result<T, SarifError>` where `SarifError` provides
//! detailed information about what went wrong:
//!
//! ```rust,no_run
//! use sarif_rust::SarifError;
//!
//! match sarif_rust::from_file("invalid.sarif") {
//!     Ok(sarif) => println!("Parsed successfully"),
//!     Err(SarifError::Io(e)) => eprintln!("IO error: {}", e),
//!     Err(SarifError::Json(e)) => eprintln!("JSON parsing error: {}", e),
//!     Err(SarifError::Validation(e)) => eprintln!("Validation error: {}", e),
//!     Err(e) => eprintln!("Other error: {}", e),
//! }
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```

// Re-export core types
pub use builder::*;
pub use parser::*;
pub use types::*;

// Core modules
pub mod builder;
pub mod parser;
pub mod types;
pub mod utils;

/// Re-export commonly used types and functions for convenience
pub mod prelude {
    pub use crate::builder::*;
    pub use crate::parser::{
        SarifParser, SarifValidator, parse_sarif_from_str, serialize_sarif_to_string,
    };
    pub use crate::types::*;
}

// Re-export common functions
pub use parser::{from_file, from_str, to_string, to_string_pretty, to_file};

/// Library version
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

/// SARIF specification version supported
pub const SARIF_VERSION: &str = "2.1.0";