pub struct Config<PK> { /* private fields */ }
Expand description
A Minimal Config Implementation
The Config struct is used to store a list of Packages (generically PK). We provide methods of reading from both JSON and TOML files
Implementations§
Source§impl<PK: Clone> Config<PK>
impl<PK: Clone> Config<PK>
Sourcepub async fn from_file<P>(path: P, mode: Mode) -> Result<Self>
pub async fn from_file<P>(path: P, mode: Mode) -> Result<Self>
Reads a configuration file (JSON or TOML) and returns a Config struct.
Sourcepub async fn from_json_file<P>(path: P) -> Result<Self>
pub async fn from_json_file<P>(path: P) -> Result<Self>
Reads a JSON file and returns a Config struct.
Sourcepub async fn from_toml_file<P>(path: P) -> Result<Self>
pub async fn from_toml_file<P>(path: P) -> Result<Self>
Reads a TOML file and returns a Config struct.
Sourcepub fn packages_owned(&self) -> Vec<PK>
pub fn packages_owned(&self) -> Vec<PK>
Returns an owned list of packages.
Trait Implementations§
Source§impl<'de, PK> Deserialize<'de> for Config<PK>where
PK: Deserialize<'de>,
impl<'de, PK> Deserialize<'de> for Config<PK>where
PK: Deserialize<'de>,
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<PK> Freeze for Config<PK>
impl<PK> RefUnwindSafe for Config<PK>where
PK: RefUnwindSafe,
impl<PK> Send for Config<PK>where
PK: Send,
impl<PK> Sync for Config<PK>where
PK: Sync,
impl<PK> Unpin for Config<PK>where
PK: Unpin,
impl<PK> UnwindSafe for Config<PK>where
PK: UnwindSafe,
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