Add support for `Url`
I need to serialize Rc<Url> when persisting lsp_types
So I need url support.
error[E0277]: the trait bound `lsp_types::Url: rkyv::Archive` is not satisfied
--> projects\ygg-bootstript\src\manager\mod.rs:19:10
|
19 | #[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
| ^^^^^^^ the trait `rkyv::Archive` is not implemented for `lsp_types::Url`
|
= note: required because of the requirements on the impl of `rkyv::Archive` for `HashMap<lsp_types::Url, FileStore>`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
= note: this error originates in the derive macro `Archive` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `lsp_types::Url: rkyv::Archive` is not satisfied
--> projects\ygg-bootstript\src\manager\mod.rs:19:19
|
19 | #[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
| ^^^^^^^^^^^ the trait `rkyv::Archive` is not implemented for `lsp_types::Url`
|
= note: required because of the requirements on the impl of `rkyv::Archive` for `HashMap<lsp_types::Url, FileStore>`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `lsp_types::Url: rkyv::Archive` is not satisfied
--> projects\ygg-bootstript\src\manager\mod.rs:19:32
|
19 | #[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
| ^^^^^^^^^ the trait `rkyv::Archive` is not implemented for `lsp_types::Url`
|
= note: required because of the requirements on the impl of `rkyv::Archive` for `HashMap<lsp_types::Url, FileStore>`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
But I don’t really understand how resolve should be executed here.
https://github.com/rkyv/rkyv/blob/cde0e14c464463468bca4441bfb20bf029540518/rkyv/src/impls/url.rs#L5-L12
Thanks for the PR! This looks like a really solid start, great work so far. In case you haven't read it yet, the book is a great reference for high-level architecture and explaining the big picture. For getting into the finer details, the documentation for Archive has two examples and the second one does a fully manual implementation.
A good way to think about it is that serialize() writes all the variable-length, out-of-line data (e.g. string bytes, boxed objects, vec elements) and returns a Resolver that stores the locations of those objects. Then, in resolve(), the archived struct is written to out and it uses the data from the original object plus the resolver to determine what to write. The docs has that second complete example for reference.
Once that's done, it's just a matter of making sure there's feature conformance (e.g. strict, endianness features) and you're good to go! Feel free to join the discord as well, there are lots of friendly and helpful people in there.
Closing due to inactivity, feel free to reopen if you pick this up again 🙂