Add a way to construct a `Workspace` without reading manifests from disk
Problem
In cargo-plumbing, we need Workspace information in almost every command. However, the current Workspace implementation has a limitation in which it requires reading the manifest file from disk during construction. This means that every invocation of a plumbing command is forced to re-read the manifest.
Plumbing commands communicate through stdout/stdin. We have a dedicated command, read-manifest, intended to read the manifests once and pass that information to other command invocations via stdin. However, we are currently blocked because Workspace construction requires reading files from disk and does not accept data already on memory.
Proposed Solution
Provide a way to construct a Workspace using in-memory data and not read from disk.
I wonder what data are needed to replicate a manifest disk read to construct a fully-functioning Workspace. A big obstacle from cargo-plumbing's side is that it works with serializable data, which has limitations on what can be represented.
Would it be fine to have an incomplete Workspace for some specific operation that don't need a full complete Workspace? I have a feeling this would be problematic but am open to ideas.
Notes
See https://github.com/crate-ci/cargo-plumbing/issues/82
Likely, the steps for this will be
- In-memory only
Manifestwhich require makingdocumentoptional, maybe evenoriginal_toml- We'd have to make having snippets for some errors / lints optional
- we may have to adjust some small things for this
- In-memory only
Package(looks like we get this for free) - In-memory
Workspace
Would it be fine to have an incomplete Workspace for some specific operation that don't need a full complete Workspace? I have a feeling this would be problematic but am open to ideas.
Unsure what would be incomplete about the workspace. Likely need more details first before we can say.