punktf_lib/profile/
link.rs

1//! Defines definitions for a [`Symlink`].
2
3use serde::{Deserialize, Serialize};
4use std::path::PathBuf;
5
6/// A symlink to be created during the deployment.
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8#[serde(deny_unknown_fields)]
9pub struct Symlink {
10	/// Absolute path of the link source.
11	pub source_path: PathBuf,
12
13	/// Absolute path of the link target.
14	pub target_path: PathBuf,
15
16	/// Indicates if any existing symlink at the [`Symlink::target_path`] should
17	/// be replaced by this item.
18	///
19	/// # NOTE
20	/// It will only replace existing symlink.
21	#[serde(default = "default_replace_value")]
22	pub replace: bool,
23}
24
25/// Provides the default value for [`Symlink::replace`].
26const fn default_replace_value() -> bool {
27	true
28}