#[non_exhaustive]pub struct Flags {
pub flags: Vec<String>,
}Expand description
A representation of rustflags or rustdocflags.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.flags: Vec<String>Implementations§
Source§impl Flags
impl Flags
Sourcepub fn from_encoded(s: &str) -> Self
pub fn from_encoded(s: &str) -> Self
Creates a rustflags or rustdocflags from a string separated with ASCII unit separator (‘\x1f’).
This is a valid format for the following environment variables:
CARGO_ENCODED_RUSTFLAGS(Cargo 1.55+)CARGO_ENCODED_RUSTDOCFLAGS(Cargo 1.55+)
See also encode.
Sourcepub fn from_space_separated(s: &str) -> Self
pub fn from_space_separated(s: &str) -> Self
Creates a rustflags or rustdocflags from a string separated with space (’ ’).
This is a valid format for the following environment variables:
RUSTFLAGSCARGO_TARGET_<triple>_RUSTFLAGSCARGO_BUILD_RUSTFLAGSRUSTDOCFLAGSCARGO_TARGET_<triple>_RUSTDOCFLAGSCARGO_BUILD_RUSTDOCFLAGS
And the following configs:
target.<triple>.rustflagstarget.<cfg>.rustflagsbuild.rustflagstarget.<triple>.rustdocflags(Cargo 1.78+)build.rustdocflags
See also encode_space_separated.
Sourcepub fn encode(&self) -> Result<String, Error>
pub fn encode(&self) -> Result<String, Error>
Concatenates this rustflags or rustdocflags with ASCII unit separator (‘\x1f’).
This is a valid format for the following environment variables:
CARGO_ENCODED_RUSTFLAGS(Cargo 1.55+)CARGO_ENCODED_RUSTDOCFLAGS(Cargo 1.55+)
§Errors
This returns an error if any of flag contains ASCII unit separator (‘\x1f’).
This is because even if you do not intend it to be interpreted as a separator, Cargo will interpret it as a separator.
Since it is not easy to insert an ASCII unit separator in a toml file or
Shell environment variable, this usually occurs when this rustflags or rustdocflags
is created in the wrong way (from_encoded vs
from_space_separated) or when a flag
containing a separator is written in the rust code (push,
into, from, etc.).
Sourcepub fn encode_space_separated(&self) -> Result<String, Error>
pub fn encode_space_separated(&self) -> Result<String, Error>
Concatenates this rustflags or rustdocflags with space (’ ’).
This is a valid format for the following environment variables:
RUSTFLAGSCARGO_TARGET_<triple>_RUSTFLAGSCARGO_BUILD_RUSTFLAGSRUSTDOCFLAGSCARGO_TARGET_<triple>_RUSTDOCFLAGSCARGO_BUILD_RUSTDOCFLAGS
And the following configs:
target.<triple>.rustflagstarget.<cfg>.rustflagsbuild.rustflagstarget.<triple>.rustdocflags(Cargo 1.78+)build.rustdocflags
§Errors
This returns an error if any of flag contains space (’ ’).
This is because even if you do not intend it to be interpreted as a separator, Cargo will interpret it as a separator.
If you run into this error, consider using a more robust
CARGO_ENCODED_* flags.