Rust plugin prevents from building a single package in workspace
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### What needs to get done
The rust plugin should support building a single (or several) package(s) in a virtual workspace. The `cargo build` command offers the `--package` flag to only build a specific package (the flag can be repeated). However it is superseeded by the `--workspace` flag which effectively instruct to build all packages (not sure if this precedence is a general rule or a positional thing).
### Why it needs to get done
While the plugin doesn't explicitely support specifying a package(s), one could abuse the [`rust_cargo_parameters`](https://github.com/canonical/craft-parts/blob/11be8c7a300b28885f9ddcd71f072fae31c440ab/craft_parts/plugins/rust_plugin.py#L50C5-L50C26) to stuff e.g. `['--package', 'foo']`.
However, the plugin [hardcode the `--workspace`](https://github.com/canonical/craft-parts/blob/11be8c7a300b28885f9ddcd71f072fae31c440ab/craft_parts/plugins/rust_plugin.py#L316) flag and all packages are built regardless of the workaround.
Edit:
Similarly, a workspace definition may contain the `default-members` entry. It defines the members of a virtual workspace that should be built in case neither `--workspace` nor `--package` are specified.
If `default-members` isn't specified either, the fallback is to build all (`--workspace`). So the hardcoded flag could probably be removed altogether from the plugin.
Source: [The cargo book](https://doc.rust-lang.org/cargo/reference/workspaces.html?highlight=workspace#workspaces).
Evaluation history
No evaluation history available.