pub struct CliUnstable {
pub print_im_a_teapot: bool,
pub unstable_options: bool,
pub offline: bool,
pub no_index_update: bool,
pub avoid_dev_deps: bool,
pub minimal_versions: bool,
pub package_features: bool,
pub advanced_env: bool,
pub config_profile: bool,
}
A parsed representation of all unstable flags that Cargo accepts.
Cargo, like rustc
, accepts a suite of -Z
flags which are intended for
gating unstable functionality to Cargo. These flags are only available on
the nightly channel of Cargo.
This struct doesn't have quite the same convenience macro that the features
have above, but the procedure should still be relatively stable for adding a
new unstable flag:
-
First, add a field to this CliUnstable
structure. All flags are allowed
to have a value as the -Z
flags are either of the form -Z foo
or
-Z foo=bar
, and it's up to you how to parse bar
.
-
Add an arm to the match statement in CliUnstable::add
below to match on
your new flag. The key (k
) is what you're matching on and the value is
in v
.
-
(optional) Add a new parsing function to parse your datatype. As of now
there's an example for bool
, but more can be added!
-
In Cargo use config.cli_unstable()
to get a reference to this structure
and then test for your flag or your value and act accordingly.
If you have any trouble with this, please let us know!
Returns the "default value" for a type. Read more
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static