bitter-ability-32190
10/25/2022, 6:07 PM1145 | target: target.strip_prefix(name.as_ref()).unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `RelativePath`, found struct `Path`
|
= note: expected reference `&RelativePath`
found reference `&Path`
But target
is of type &RelativePath
and strip_prefix
returns `&RelativePath`: https://docs.rs/relative-path/1.5.0/relative_path/struct.RelativePath.html#method.strip_prefix
What am I missing?witty-crayon-22786
10/25/2022, 6:09 PMRelativePath
`Deref`s to `Path`… but, uh: note that this isn’t the relative_path crate: we define this one in src/rust/engine/fs/src/lib.rs
witty-crayon-22786
10/25/2022, 6:09 PMPath
fast-nail-55400
10/25/2022, 6:15 PMRelativePath
implements AsRef<Path>
. so just call .as_ref()
on the RelativePath
instance.fast-nail-55400
10/25/2022, 6:15 PMDeref<Target = PathBuf>
)fast-nail-55400
10/25/2022, 6:17 PMRelativePath
should implement Deref<Target = Path>
to match AsRef<Path>
and then have an into_inner
method (and friends) if callers want the contained PathBuf
bitter-ability-32190
10/25/2022, 6:21 PM.as_ref()
on target
and on the result type isn't itbitter-ability-32190
10/25/2022, 6:29 PMnote that this isn’t the relative_path crate: we define this one inohhhh
bitter-ability-32190
10/25/2022, 6:29 PMPath
so strip_prefix
would work. But now I gotta get it back to the world of RelativePath
. Buenobitter-ability-32190
10/25/2022, 6:31 PMbitter-ability-32190
10/25/2022, 6:42 PMstrip_prefix
on RelativePath
?bitter-ability-32190
10/25/2022, 6:46 PMbitter-ability-32190
10/25/2022, 6:58 PMRelativePath
?witty-crayon-22786
10/25/2022, 6:58 PMwitty-crayon-22786
10/25/2022, 6:58 PMwitty-crayon-22786
10/25/2022, 6:59 PMRelativePath::new
after the strip_prefix call…?bitter-ability-32190
10/25/2022, 7:00 PMwitty-crayon-22786
10/25/2022, 7:00 PMbitter-ability-32190
10/25/2022, 7:02 PMthejcannon:symlinks
in <http://directory.rs:1152|directory.rs:1152>
bitter-ability-32190
10/25/2022, 7:02 PMbitter-ability-32190
10/25/2022, 7:04 PMwitty-crayon-22786
10/25/2022, 7:04 PMbitter-ability-32190
10/25/2022, 7:07 PMwitty-crayon-22786
10/25/2022, 7:08 PMbitter-ability-32190
10/25/2022, 7:08 PMbitter-ability-32190
10/25/2022, 7:10 PMbitter-ability-32190
10/25/2022, 7:10 PMsymlinks
witty-crayon-22786
10/25/2022, 7:10 PMwitty-crayon-22786
10/25/2022, 7:11 PMwitty-crayon-22786
10/25/2022, 7:12 PMSymlink
even necessarily be holding a relativepath? should be a path right?witty-crayon-22786
10/25/2022, 7:12 PMwitty-crayon-22786
10/25/2022, 7:13 PMRelativePath
probably.bitter-ability-32190
10/25/2022, 7:14 PMbitter-ability-32190
10/25/2022, 7:16 PMwitty-crayon-22786
10/25/2022, 7:17 PMbitter-ability-32190
10/25/2022, 7:25 PMbitter-ability-32190
10/25/2022, 7:25 PMbitter-ability-32190
10/25/2022, 7:38 PMfast-nail-55400
10/25/2022, 7:58 PMbitter-ability-32190
10/25/2022, 7:59 PMfast-nail-55400
10/25/2022, 8:09 PMbitter-ability-32190
10/25/2022, 8:10 PM