Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub generated: GlobSet,
    pub not_generated: GlobSet,
    pub attributes: Vec<String>,
    pub grouping: GroupingConfig,
    pub review: ReviewConfig,
    pub keys: KeysConfig,
}

Fields§

§generated: GlobSet

Additive globs marking files as generated (noise-tier hint).

§not_generated: GlobSet

Overrides: never mark these generated. Wins over everything.

§attributes: Vec<String>

gitattributes attribute names honoured as “generated” declarations. Defaults to DEFAULT_ATTRIBUTES; setting the key replaces the list rather than adding to it.

§grouping: GroupingConfig

From the USER config, never the repo (agents differ per user).

§review: ReviewConfig

From the USER config: how much context the reviewer shows.

§keys: KeysConfig

From the USER config: which keys the reviewer’s actions answer to.

Implementations§

Source§

impl Config

Source

pub fn load<S: ConfigSource>( src: &S, repo_root: &Path, repo_override: Option<&Path>, user_override: Option<&Path>, ) -> Result<Config, EngineError>

Resolution, per file: explicit path > default location > defaults. A missing file means defaults; a malformed file is a hard error, never silently ignored.

Repo file: <repo-root>/.differential.toml — classification hints. User file: ~/.config/differential/config.toml — [grouping].

Source

pub fn load_user<S: ConfigSource>( src: &S, user_override: Option<&Path>, ) -> Result<UserConfig, EngineError>

The USER file alone: [grouping], [review] and [keys], and no repository.

load needs a repository root to find the repo file. dfr agents has none — which agent you would run is a per-user choice and the question is answerable from anywhere. Rather than hand it a directory it has no use for, the user half is its own call, and load goes through it so there is one answer to “where does the user file live”.

A missing file means defaults; a malformed one is a hard error.

Source

pub fn parse(text: &str, origin: &str) -> Result<Config, EngineError>

Parse the REPO file: classification hints only. A [grouping] table here is a hard error with a pointer to its new home.

Source

pub fn parse_user(text: &str, origin: &str) -> Result<UserConfig, EngineError>

Parse the USER file: [grouping], [review] and [keys].

Source§

impl Config

Source

pub fn render_user(user: &UserConfig) -> String

The user file as TOML, whole. What save_user writes: every [review] value, the [grouping] values that are set, and [keys] only when an action is rebound.

Source

pub fn save_user<S: ConfigSource>( src: &S, path: &Path, user: &UserConfig, ) -> Result<(), EngineError>

Write the user file at path, REPLACING it (ADR 0037).

Whole-file on purpose: the reviewer’s config modal edits every setting, and a rewrite is the one form that cannot disagree with what it shows. The cost is the file’s comments and layout, which the modal says before it saves.

The text is parsed back before it is written, so the file on disk is always one parse_user accepts, and accepts as this value.

Trait Implementations§

Source§

impl Debug for Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Self

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.