pub struct PatternMapping {
pub glob: String,
pub destination: Option<String>,
}Expand description
A parsed pattern entry with an optional destination prefix.
The raw config value uses the syntax <glob> or <glob>:<destination>.
For example:
src/**– matchsrc/**, no remapping (files keep their upstream path)src/**:ext/– matchsrc/**, strip the literal prefixsrc/, then prependext/to get the local path.
Fields§
§glob: StringThe glob string (left of the colon, or the whole value when no colon).
destination: Option<String>The local destination prefix (right of the colon), if present.
Implementations§
Source§impl PatternMapping
impl PatternMapping
Sourcepub fn literal_prefix(&self) -> &str
pub fn literal_prefix(&self) -> &str
Extract the literal (non-glob) leading path component(s) from the glob.
“Literal prefix” is everything before the first glob character (*, ?,
[). For src/**/*.rs this returns src/. For ** it returns "".
Sourcepub fn local_path(&self, upstream_path: &str) -> Option<String>
pub fn local_path(&self, upstream_path: &str) -> Option<String>
Compute the local path for an upstream file that matched this pattern.
- Strip the literal prefix from
upstream_path. - If a
destinationis set, prepend it.
Returns None if the upstream path doesn’t start with the literal
prefix (which shouldn’t happen when the glob matched, but we guard
defensively).
Trait Implementations§
Source§impl Clone for PatternMapping
impl Clone for PatternMapping
Source§fn clone(&self) -> PatternMapping
fn clone(&self) -> PatternMapping
Returns a duplicate of the value. Read more
1.0.0 · 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 PatternMapping
impl Debug for PatternMapping
Source§impl PartialEq for PatternMapping
impl PartialEq for PatternMapping
impl Eq for PatternMapping
impl StructuralPartialEq for PatternMapping
Auto Trait Implementations§
impl Freeze for PatternMapping
impl RefUnwindSafe for PatternMapping
impl Send for PatternMapping
impl Sync for PatternMapping
impl Unpin for PatternMapping
impl UnsafeUnpin for PatternMapping
impl UnwindSafe for PatternMapping
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