pub enum InstallRule {
Glob(GlobRule),
Route(RouteRule),
}Expand description
A file-mapping rule that can be either a GlobRule or a RouteRule.
§Examples
use camino::Utf8Path;
use loadsmith_install::{InstallRule, GlobRule, RouteRule};
let glob: InstallRule = GlobRule::try_from_pattern("*.dll", Utf8Path::new("BepInEx/plugins")).unwrap().into();
let route: InstallRule = RouteRule::new_static("plugins").into();Variants§
Glob(GlobRule)
Maps files using a glob pattern.
Route(RouteRule)
Maps files by matching a route (directory name) and file extension.
Implementations§
Source§impl InstallRule
impl InstallRule
Sourcepub fn matches(&self, path: impl AsRef<Utf8Path>) -> bool
pub fn matches(&self, path: impl AsRef<Utf8Path>) -> bool
Returns true if the path matches this rule by path content or file extension.
Sourcepub fn matches_path(&self, path: impl AsRef<Utf8Path>) -> bool
pub fn matches_path(&self, path: impl AsRef<Utf8Path>) -> bool
Sourcepub fn matches_extension(&self, path: impl AsRef<Utf8Path>) -> bool
pub fn matches_extension(&self, path: impl AsRef<Utf8Path>) -> bool
Sourcepub fn map_file(
&self,
path: impl AsRef<Utf8Path>,
package: &PackageRef,
) -> Option<Utf8PathBuf>
pub fn map_file( &self, path: impl AsRef<Utf8Path>, package: &PackageRef, ) -> Option<Utf8PathBuf>
Maps a file path to its install destination.
Sourcepub fn matches_mapped(&self, path: impl AsRef<Utf8Path>) -> bool
pub fn matches_mapped(&self, path: impl AsRef<Utf8Path>) -> bool
Returns true if the mapped path starts with this rule’s target directory.
Sourcepub fn conflict_strategy(&self) -> ConflictStrategy
pub fn conflict_strategy(&self) -> ConflictStrategy
Trait Implementations§
Source§impl Clone for InstallRule
impl Clone for InstallRule
Source§fn clone(&self) -> InstallRule
fn clone(&self) -> InstallRule
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InstallRule
impl Debug for InstallRule
Source§impl<'de> Deserialize<'de> for InstallRule
impl<'de> Deserialize<'de> for InstallRule
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
impl Eq for InstallRule
Source§impl From<GlobRule> for InstallRule
impl From<GlobRule> for InstallRule
Source§impl From<RouteRule> for InstallRule
impl From<RouteRule> for InstallRule
Source§impl PartialEq for InstallRule
impl PartialEq for InstallRule
Source§impl Serialize for InstallRule
impl Serialize for InstallRule
impl StructuralPartialEq for InstallRule
Auto Trait Implementations§
impl Freeze for InstallRule
impl RefUnwindSafe for InstallRule
impl Send for InstallRule
impl Sync for InstallRule
impl Unpin for InstallRule
impl UnsafeUnpin for InstallRule
impl UnwindSafe for InstallRule
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.