ConfigBuilder

Struct ConfigBuilder 

Source
pub struct ConfigBuilder { /* private fields */ }
Expand description

Builder for creating configurations programmatically

Implementations§

Source§

impl ConfigBuilder

Source

pub fn new() -> Self

Creates a new configuration builder

§Returns

A new ConfigBuilder with default values

§Examples
use rust_diff_analyzer::config::ConfigBuilder;

let builder = ConfigBuilder::new();
Source

pub fn output_format(self, format: OutputFormat) -> Self

Sets the output format

§Arguments
  • format - Output format to use
§Returns

Self for method chaining

§Examples
use rust_diff_analyzer::config::{ConfigBuilder, OutputFormat};

let config = ConfigBuilder::new()
    .output_format(OutputFormat::Json)
    .build();
Source

pub fn max_prod_units(self, limit: usize) -> Self

Sets the maximum production units limit

§Arguments
  • limit - Maximum number of production units
§Returns

Self for method chaining

§Examples
use rust_diff_analyzer::config::ConfigBuilder;

let config = ConfigBuilder::new().max_prod_units(50).build();
Source

pub fn max_weighted_score(self, limit: usize) -> Self

Sets the maximum weighted score limit

§Arguments
  • limit - Maximum weighted score
§Returns

Self for method chaining

§Examples
use rust_diff_analyzer::config::ConfigBuilder;

let config = ConfigBuilder::new().max_weighted_score(200).build();
Source

pub fn fail_on_exceed(self, fail: bool) -> Self

Sets whether to fail on exceeded limits

§Arguments
  • fail - Whether to fail on exceeded limits
§Returns

Self for method chaining

§Examples
use rust_diff_analyzer::config::ConfigBuilder;

let config = ConfigBuilder::new().fail_on_exceed(false).build();
Source

pub fn max_prod_lines(self, limit: usize) -> Self

Sets the maximum production lines limit

§Arguments
  • limit - Maximum number of production lines added
§Returns

Self for method chaining

§Examples
use rust_diff_analyzer::config::ConfigBuilder;

let config = ConfigBuilder::new().max_prod_lines(200).build();
Source

pub fn per_type_limits(self, limits: PerTypeLimits) -> Self

Sets per-type limits

§Arguments
  • limits - Per-type limit configuration
§Returns

Self for method chaining

§Examples
use rust_diff_analyzer::config::{ConfigBuilder, PerTypeLimits};

let per_type = PerTypeLimits {
    functions: Some(5),
    structs: Some(3),
    ..Default::default()
};
let config = ConfigBuilder::new().per_type_limits(per_type).build();
Source

pub fn add_test_feature(self, feature: &str) -> Self

Adds a test feature

§Arguments
  • feature - Feature name to add
§Returns

Self for method chaining

§Examples
use rust_diff_analyzer::config::ConfigBuilder;

let config = ConfigBuilder::new()
    .add_test_feature("my-test-feature")
    .build();
Source

pub fn add_ignore_path(self, path: &str) -> Self

Adds a path to ignore

§Arguments
  • path - Path pattern to ignore
§Returns

Self for method chaining

§Examples
use rust_diff_analyzer::config::ConfigBuilder;

let config = ConfigBuilder::new().add_ignore_path("fixtures/").build();
Source

pub fn build(self) -> Config

Builds the configuration

§Returns

The built Config

§Examples
use rust_diff_analyzer::config::ConfigBuilder;

let config = ConfigBuilder::new().build();

Trait Implementations§

Source§

impl Debug for ConfigBuilder

Source§

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

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

impl Default for ConfigBuilder

Source§

fn default() -> ConfigBuilder

Returns the “default value” for a type. Read more

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.

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> Same for T

Source§

type Output = T

Should always be Self
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.