pub enum ImportSource {
R2modmanDir(PathBuf),
Archive(PathBuf),
Code(String),
}Expand description
What an import source string names.
A user or a UI hands over one string for “import this”, and which of the
three import routes it means is decided by looking at the filesystem. That
decision is made here, once, so no caller re-derives it: a caller that wants
to word the routes differently, or preview what a pasted string would do,
matches on this instead of stating its own is_dir/is_file rules.
Deliberately not #[non_exhaustive], matching
BadProfile and
NotRemovable: a caller that words each route
should stop compiling when a fourth appears.
Variants§
R2modmanDir(PathBuf)
An existing directory, treated as an r2modman profile to adopt in place.
Archive(PathBuf)
An existing file, treated as a .r2z export.
Code(String)
Anything else, treated as a shareable Thunderstore profile code.
Implementations§
Source§impl ImportSource
impl ImportSource
Sourcepub fn classify(source: &str) -> Self
pub fn classify(source: &str) -> Self
Classifies one import source string.
A path that exists but is neither a directory nor a regular file (a
dangling symlink, a socket) falls through to Self::Code, where the
attempt fails naming the code endpoint. is_dir/is_file follow symlinks,
so a link to either is classified as its destination.
Trait Implementations§
Source§impl Clone for ImportSource
impl Clone for ImportSource
Source§impl Debug for ImportSource
impl Debug for ImportSource
impl Eq for ImportSource
Source§impl PartialEq for ImportSource
impl PartialEq for ImportSource
impl StructuralPartialEq for ImportSource
Auto Trait Implementations§
impl Freeze for ImportSource
impl RefUnwindSafe for ImportSource
impl Send for ImportSource
impl Sync for ImportSource
impl Unpin for ImportSource
impl UnsafeUnpin for ImportSource
impl UnwindSafe for ImportSource
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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
key and return true if they are equal.