[−][src]Struct superfusion::index::Index
A relative path to the project that also carry information about where the path is from.
Implementations
impl Index
[src]
pub fn new(pid: Pid, path: impl Into<PathBuf>) -> Self
[src]
pub fn path(&self) -> &Path
[src]
pub fn pid(&self) -> &Pid
[src]
pub fn is_similar(&self, other: &Self) -> bool
[src]
Compare only the path
component of this struct
let foo = Index::new(Pid::new(0), "./path/to/index"); let bar = Index::new(Pid::new(1), "./path/to/index"); assert!(foo.is_similar(&bar)); let baz = Index::new(Pid::new(1), "./not/a/path/to/index"); assert!(!foo.is_similar(&baz));
pub fn rename<F>(&self, format: F) -> Result<Self, Error> where
F: Fn(&Pid, &str) -> String,
[src]
F: Fn(&Pid, &str) -> String,
This method will attempt to create a file name that is unique across the entire workspace. It's usually called when workspace found a conflicting file.
Note
format
is a 'formatter function', this function must return a unique formatted string base on itsPid
and filename.- Changing file extension is not permitted.
Error
This function can fail in the following errors:
- Logical parent does not exists. (Path like
./
does not have logical parent) - Unable to get file stem of this path. (Check Path::file_stem())
pub fn prefix(&self, root: &Path) -> PathBuf
[src]
Transforming the Index into full path again by prefixing the relative path with the given root
pub fn with_pid(&self, pid: Pid) -> Self
[src]
Return the same Index with different Pid
Trait Implementations
impl Clone for Index
[src]
impl Debug for Index
[src]
impl Display for Index
[src]
impl Eq for Index
[src]
impl<'a> FromIterator<&'a Index> for IndexList<'a>
[src]
fn from_iter<T: IntoIterator<Item = &'a Index>>(iter: T) -> Self
[src]
impl Hash for Index
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Index> for Index
[src]
impl StructuralEq for Index
[src]
impl StructuralPartialEq for Index
[src]
Auto Trait Implementations
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,