Skip to main content

Package

Struct Package 

Source
pub struct Package {
Show 14 fields pub name: String, pub src: String, pub dest: String, pub dependencies: Option<Vec<String>>, pub variables: Table, pub pre_actions: Vec<String>, pub post_actions: Vec<String>, pub targets: HashMap<String, String>, pub skip: bool, pub prompts: HashMap<String, String>, pub ignore: Vec<String>, pub symlink: Option<bool>, pub unfold_symlink: bool, pub clean: bool,
}

Fields§

§name: String§src: String§dest: String§dependencies: Option<Vec<String>>§variables: Table§pre_actions: Vec<String>§post_actions: Vec<String>§targets: HashMap<String, String>§skip: bool§prompts: HashMap<String, String>§ignore: Vec<String>§symlink: Option<bool>§unfold_symlink: bool§clean: bool

Implementations§

Source§

impl Package

Source

pub fn new(name: &str, src: &str, dest: &str) -> Self

Source

pub fn from_path(args: &ImportArgs, cwd: &Path) -> Result<Self, Error>

Source

pub fn from_table(pkg_name: &str, pkg_val: &Table) -> Result<Self, Error>

Source

pub fn execute_action( &self, action: &str, variables: &Table, working_dir: &Path, dry_run: bool, ) -> Result<()>

Source

pub fn execute_pre_actions(&self, ctx: &Context, dry_run: bool) -> Result<()>

Source

pub fn execute_post_actions(&self, ctx: &Context, dry_run: bool) -> Result<()>

Source

pub fn get_context_variables(&self, ctx: &Context) -> Table

Source

pub fn should_ignore(&self, rel_path: &Path) -> bool

Source

pub fn should_unfold(&self) -> bool

Whether a directory package should be deployed as individual per-file symlinks (leaving the destination a real directory) rather than a single symlink for the whole directory. Non-empty ignore implies this, since an ignored path has nowhere real to live under a single whole-directory symlink.

Whether this package should be deployed as a symlink. An explicit per-package symlink setting always wins - Some(true) forces it on and Some(false) opts out - regardless of the global config flag; only when the package leaves it unset does the global flag apply.

Source

pub fn resolve_deployment_path(&self, ctx: &Context) -> Result<PathBuf>

Source

pub fn backup( &self, ctx: &Context, args: &UpdateArgs, ) -> Result<BackupDeployResult>

Backup the package by copying files from dest to a backup location, recursively.

Source

pub fn should_clean(&self, arg_val: Option<bool>) -> bool

Source

pub fn resolve_dest(&self, ctx: &Context) -> Result<PathBuf>

Resolves this package’s effective deployment path for the active profile: an entry in targets keyed by the profile’s own name wins (most specific), then one keyed by the profile’s platform (shared across every profile with that platform), then the package’s dest.

Source

pub fn diff_file( &self, src: &PathBuf, dest: &PathBuf, ctx: &Context, ) -> Result<(), Error>

Source

pub fn diff(&self, ctx: &Context) -> Result<(), Error>

Source

pub fn deploy_file( &self, src: &PathBuf, dest: &PathBuf, ctx: &Context, backup: bool, dry_run: bool, ) -> Result<BackupDeployResult, Error>

Source

pub fn deploy( &self, ctx: &Context, args: &DeployArgs, ) -> Result<BackupDeployResult, Error>

Deploy the package by copying files from src to dest.

Source

pub fn package_is_templated(&self, cwd: &Path) -> bool

Trait Implementations§

Source§

impl Clone for Package

Source§

fn clone(&self) -> Package

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Package

Source§

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

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

impl Default for Package

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Package

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 Package

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more