Skip to main content

RepoConfigLayers

Struct RepoConfigLayers 

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

A repository’s configuration as the two files that can contribute to it.

The project file wins every scalar key it names, and the personal file answers the rest. That is the inverse of the usual local-overrides-committed convention, and deliberately so: the settings here are the ones a project decides, and a team that has written down “this repository is not worth pruning” wants that to survive a teammate’s stale personal file rather than lose to it.

“Names a key” means the key is literally in the file. A project file silent on ignore does not overrule the personal one with serde’s false, because a default filled in by the deserializer is not something anybody wrote down.

prunable.directories is the one thing that unions instead of winning. It is a list of separate declarations rather than a single decided value, so there is nothing for one file to win: “the team says this cache is rebuildable” and “so is this one on my machine” are both true at once, and a rule that let the committed file silence the personal list would delete somebody’s own declaration the day their team wrote their first one.

Nothing here widens what a repository can ask for. Both files deserialize into the same PerRepoConfig, so the two settings the type deliberately does not carry — allow_manifest_rewrite and post_prune_command — are still absent from both, and every field that is present is either display-only or scope-shaping. A committed .devprune.json has had exactly this reach since 1.0.0, since the .git/info/exclude entry is local to one clone and excludes nothing already tracked; the shared file makes that reach a named, documented file instead of an accident.

Implementations§

Source§

impl RepoConfigLayers

Source

pub fn load(repo_path: &Path) -> Result<Self, String>

Read both files. Err if either exists and does not parse.

Source

pub fn effective(&self) -> Option<PerRepoConfig>

The merged configuration, or None when the repository has neither file.

None rather than the defaults, because every caller of this treats “no config” and “a config that happens to match the defaults” as the same thing to act on but not the same thing to report.

Source

pub fn project_config(&self) -> Option<&PerRepoConfig>

The committed file as it stands, before the personal one fills any gaps in.

Source

pub fn personal_config(&self) -> Option<&PerRepoConfig>

The personal file as it stands, before the project one overrules any of it.

Source

pub fn rows(&self) -> Vec<(&'static str, String, ConfigSource)>

Which file each setting’s effective value came from.

This is what gets shown instead of copying the project file’s values into .devprune.json as a visible “mirror”. A second copy of a value is a second copy free to drift from the first, and the question somebody actually has in front of two config files is not “what does each say” but “which one won”.

Source

pub fn source_of(&self, key: &str) -> ConfigSource

Which file spelled this key out, in precedence order.

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

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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, <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.