Struct DevShellConfig

Source
pub struct DevShellConfig {
    pub packages: BTreeSet<String>,
    pub shell_hook: Option<String>,
    pub pure: Option<bool>,
}
Expand description

@brief Represents the structure of the devshell.toml file.

Maintains a set of packages, an optional shell hook, and an optional purity flag. BTreeSet is used to keep packages sorted and unique.

Fields§

§packages: BTreeSet<String>

@brief Set of package names to be included in the development shell.

§shell_hook: Option<String>

@brief Optional shell hook command to be executed in the shell.

§pure: Option<bool>

@brief Optional flag to indicate if the shell should be pure.

Implementations§

Source§

impl DevShellConfig

Source

pub fn load() -> Result<Self, Error>

@brief Loads the configuration from CONFIG_FILE or returns a default config if not found. @return Result containing the loaded DevShellConfig or an I/O error.

Source

pub fn save(&self) -> Result<(), Error>

@brief Saves the current configuration to CONFIG_FILE. @return Result indicating success or an I/O error.

Source

pub fn append_hook(&mut self, new_hook: &str)

@brief Appends a new shell hook command to the existing shell hook.

If a shell hook already exists, the new hook is appended with a separator. If not, the new hook is set as the shell hook. @param new_hook The shell hook command to append.

Trait Implementations§

Source§

impl Debug for DevShellConfig

Source§

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

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

impl Default for DevShellConfig

Source§

fn default() -> DevShellConfig

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

impl<'de> Deserialize<'de> for DevShellConfig

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 DevShellConfig

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,