Struct cargo_config2::Flags
source · #[non_exhaustive]pub struct Flags {
pub flags: Vec<String>,
}Expand description
A representation of rustflags and 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 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 from a string separated with space (’ ’).
This is a valid format for the following environment variables:
RUSTFLAGSCARGO_TARGET_<triple>_RUSTFLAGSCARGO_BUILD_RUSTFLAGSRUSTDOCFLAGSCARGO_BUILD_RUSTDOCFLAGS
And the following configs:
target.<triple>.rustflagstarget.<cfg>.rustflagsbuild.rustflagsbuild.rustdocflags
See also encode_space_separated.
sourcepub fn encode(&self) -> Result<String, Error>
pub fn encode(&self) -> Result<String, Error>
Concatenates this rustflags 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 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 with space (’ ’).
This is a valid format for the following environment variables:
RUSTFLAGSCARGO_TARGET_<triple>_RUSTFLAGSCARGO_BUILD_RUSTFLAGSRUSTDOCFLAGSCARGO_BUILD_RUSTDOCFLAGS
And the following configs:
target.<triple>.rustflagstarget.<cfg>.rustflagsbuild.rustflagsbuild.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.
Trait Implementations§
source§impl PartialEq for Flags
impl PartialEq for Flags
impl Eq for Flags
impl StructuralPartialEq for Flags
Auto Trait Implementations§
impl Freeze for Flags
impl RefUnwindSafe for Flags
impl Send for Flags
impl Sync for Flags
impl Unpin for Flags
impl UnwindSafe for Flags
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.