Skip to main content

Metadata

Struct Metadata 

Source
pub struct Metadata {
    pub installed: InstalledInfo,
    pub files: HashMap<String, String>,
    pub merged: HashMap<String, HashMap<String, Vec<String>>>,
}

Fields§

§installed: InstalledInfo§files: HashMap<String, String>§merged: HashMap<String, HashMap<String, Vec<String>>>

Tracks merged JSON entries per profile: profile_name -> file_path -> [json_paths]

Implementations§

Source§

impl Metadata

Source

pub fn new(base_dir: &Path) -> Self

Source

pub fn load(target: &Path) -> Result<Option<Self>>

Source

pub fn save(&self, target: &Path) -> Result<()>

Source

pub fn add_profile(&mut self, name: &str)

Source

pub fn remove_profile(&mut self, name: &str)

Source

pub fn add_file(&mut self, path: &str, hash: &str)

Source

pub fn remove_file(&mut self, path: &str)

Source

pub fn get_file_hash(&self, path: &str) -> Option<&String>

Source

pub fn add_merged( &mut self, profile: &str, file_path: &str, json_paths: Vec<String>, )

Record merged JSON paths for a profile

Source

pub fn get_merged(&self, profile: &str, file_path: &str) -> Option<&Vec<String>>

Get merged JSON paths for a profile and file

Source

pub fn get_merged_files( &self, profile: &str, ) -> Option<&HashMap<String, Vec<String>>>

Get all merged files for a profile

Source

pub fn remove_merged(&mut self, profile: &str)

Remove all merged entries for a profile

Trait Implementations§

Source§

impl Debug for Metadata

Source§

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

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

impl<'de> Deserialize<'de> for Metadata

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Metadata

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.