Skip to content

Commit

Permalink
Add default member description in virtual workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
heisen-li committed Apr 15, 2024
1 parent fd848d1 commit aad3a1b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/doc/src/reference/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ To create a workspace, you add the `[workspace]` table to a `Cargo.toml`:
# ...
```

The directory where the workspace's Cargo.toml is located then becomes so-called the workspace root.

At minimum, a workspace has to have a member, either with a root package or as
a virtual manifest.

### Root package

If the [`[workspace]` section](#the-workspace-section) is added to a
`Cargo.toml` that already defines a `[package]`, the package is
the *root package* of the workspace.
the *root package* of the workspace. The *workspace root* is the directory
where the workspace's `Cargo.toml` is located.

Example:
```toml
Expand All @@ -60,12 +59,13 @@ version = "0.1.0" # the current version, obeying semver
authors = ["Alice <[email protected]>", "Bob <[email protected]>"]
```

Under [workspace](#the-workspace-section), you can specify which members the workspace has through
[workspace.members filed](#the-members-and-exclude-fields) .
In the [worksapce section](#the-workspace-section), you can specify the members of
the workspace by [workspace.members filed](#the-members-and-exclude-fields).

If no other members are specified in [workspace.members filed](#the-members-and-exclude-fields)
in `Cargo.toml` in the workspace root directory, the root package will
become the default workspace member.
become the default workspace member. In addition, you can also specify the default
workspace members through [workspace.default-members](#the-default-members-field).

### Virtual workspace

Expand All @@ -90,6 +90,10 @@ edition = "2021" # the edition, will have no effect on a resolver used in th
authors = ["Alice <[email protected]>", "Bob <[email protected]>"]
```

In a virtual workspace, at least one member needed be included and if
[workspace.default-member](#the-default-members-field) is empty, all members of
the workspace are default members.

Note that in a virtual manifest the [`resolver = "2"`](resolver.md#resolver-versions)
should be specified manually. It is usually deduced from the [`package.edition`][package-edition]
field which is absent in virtual manifests and the edition field of a member
Expand Down

0 comments on commit aad3a1b

Please sign in to comment.