pub struct Config {
pub classification: ClassificationConfig,
pub weights: WeightsConfig,
pub limits: LimitsConfig,
pub output: OutputConfig,
}Expand description
Main configuration structure
Fields§
§classification: ClassificationConfigClassification settings
weights: WeightsConfigWeight settings
limits: LimitsConfigLimit settings
output: OutputConfigOutput settings
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_file(path: &Path) -> Result<Self, AppError>
pub fn from_file(path: &Path) -> Result<Self, AppError>
Loads configuration from a TOML file
§Arguments
path- Path to the configuration file
§Returns
Loaded configuration or error
§Errors
Returns error if file cannot be read or parsed
§Examples
use std::path::Path;
use rust_diff_analyzer::Config;
let config = Config::from_file(Path::new(".rust-diff-analyzer.toml"));Sourcepub fn test_features_set(&self) -> HashSet<&str>
pub fn test_features_set(&self) -> HashSet<&str>
Sourcepub fn should_ignore(&self, path: &Path) -> bool
pub fn should_ignore(&self, path: &Path) -> bool
Sourcepub fn is_test_path(&self, path: &Path) -> bool
pub fn is_test_path(&self, path: &Path) -> bool
Checks if a path is in a test directory
§Arguments
path- Path to check
§Returns
true if path is in a test directory
§Examples
use std::path::Path;
use rust_diff_analyzer::Config;
let config = Config::default();
assert!(config.is_test_path(Path::new("tests/integration.rs")));
assert!(!config.is_test_path(Path::new("src/lib.rs")));Sourcepub fn is_build_script(&self, path: &Path) -> bool
pub fn is_build_script(&self, path: &Path) -> bool
Checks if path is a build script
§Arguments
path- Path to check
§Returns
true if path is build.rs
§Examples
use std::path::Path;
use rust_diff_analyzer::Config;
let config = Config::default();
assert!(config.is_build_script(Path::new("build.rs")));
assert!(!config.is_build_script(Path::new("src/lib.rs")));Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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