You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to use ariadne::FileCache with Report::write (or print or eprint), but it doesn't seem to work for me.FileCache implements Cache<Path> but not Cache<PathBuf>, and as std::path::Path isn't sized, I can't pass a Path directly into Report::build or a Label. Using &Path in the following minimal example:
error[E0277]: the trait bound `ariadne::FileCache: Cache<&Path>` is not satisfied
--> src/parsing.rs:19:29
|
19 | builder.finish().eprint(fc).unwrap();
| ------ ^^ the trait `Cache<&Path>` is not implemented for `ariadne::FileCache`
| |
| required by a bound introduced by this call
|
= help: the trait `Cache<Path>` is implemented for `ariadne::FileCache`
note: required by a bound in `ariadne::Report::<S>::eprint`
--> /home/jon/.cargo/registry/src/github.com-1ecc6299db9ec823/ariadne-0.1.5/src/lib.rs:159:22
|
159 | pub fn eprint<C: Cache<S::SourceId>>(&self, cache: C) -> io::Result<()> {
| ^^^^^^^^^^^^^^^^^^ required by this bound in `ariadne::Report::<S>::eprint`
For more information about this error, try `rustc --explain E0277`.
This is using ariadne 0.1.5.
Thanks!
The text was updated successfully, but these errors were encountered:
Argh, this is a frustrating oversight. For now, FnCache or a custom implementation of Cache should be sufficient. This API does require a pretty significant redesign though. I'll see whether I get the opportunity to do this over the next week!
I just stumbled on this same issue. If nothing else can FileCache be removed until a solution exists. It would have saved me a lot of time. As it was I saw what was clearly what I wanted and was banging my head against the wall trying to figure out how to get it to work, where I would have just used the FnCache if that was the only option.
Also it looks like FnCache doesn't work with Path/PathBuf either due to the requirement for Display that Path doesn't meet. So a custom implementation is required to work with Path/PathBuf. Not a big deal, just pointing it out.
I'm attempting to use
ariadne::FileCache
withReport::write
(orprint
oreprint
), but it doesn't seem to work for me.FileCache
implementsCache<Path>
but notCache<PathBuf>
, and asstd::path::Path
isn't sized, I can't pass aPath
directly intoReport::build
or aLabel
. Using&Path
in the following minimal example:yields the following error:
This is using ariadne 0.1.5.
Thanks!
The text was updated successfully, but these errors were encountered: