Enum guppy::platform::PlatformSpecSummary [−][src]
pub enum PlatformSpecSummary {
Always,
Platform(PlatformSummary),
Any,
}
Expand description
A serializable version of PlatformSpec
.
Requires the summaries
feature to be enabled.
Variants
The intersection of all platforms.
This is converted to and from PlatformSpec::Always
, and is expressed as the string
"always"
, or as spec = "always"
.
Examples
Deserialize the string "always"
.
let spec: PlatformSpecSummary = serde_json::from_str(r#""always""#).unwrap();
assert_eq!(spec, PlatformSpecSummary::Always);
Deserialize spec = "always"
.
let spec: PlatformSpecSummary = toml::from_str(r#"spec = "always""#).unwrap();
assert_eq!(spec, PlatformSpecSummary::Always);
Platform(PlatformSummary)
An individual platform.
This is converted to and from PlatformSpec::Platform
, and is serialized as the platform
itself (either a triple string, or a map such as
{ triple = "x86_64-unknown-linux-gnu", target-features = [] }
).
Examples
Deserialize a target triple.
let spec: PlatformSpecSummary = serde_json::from_str(r#""x86_64-unknown-linux-gnu""#).unwrap();
assert_eq!(spec, PlatformSpecSummary::Platform(PlatformSummary {
triple: "x86_64-unknown-linux-gnu".to_owned(),
target_features: TargetFeaturesSummary::Unknown,
flags: BTreeSet::new(),
}));
Deserialize a target map.
let spec: PlatformSpecSummary = toml::from_str(r#"
triple = "x86_64-unknown-linux-gnu"
target-features = []
flags = []
"#).unwrap();
assert_eq!(spec, PlatformSpecSummary::Platform(PlatformSummary {
triple: "x86_64-unknown-linux-gnu".to_owned(),
target_features: TargetFeaturesSummary::Features(BTreeSet::new()),
flags: BTreeSet::new(),
}));
Tuple Fields of Platform
The union of all platforms.
This is converted to and from PlatformSpec::Any
, and is serialized as the string
"any"
.
This is also the default, since in many cases one desires to compute the union of enabled dependencies across all platforms.
Examples
Deserialize the string "any"
.
let spec: PlatformSpecSummary = serde_json::from_str(r#""any""#).unwrap();
assert_eq!(spec, PlatformSpecSummary::Any);
Deserialize spec = "any"
.
let spec: PlatformSpecSummary = toml::from_str(r#"spec = "any""#).unwrap();
assert_eq!(spec, PlatformSpecSummary::Any);
Implementations
Creates a new PlatformSpecSummary
from a PlatformSpec
.
Converts self
to a PlatformSpec
.
Returns an Error
if the platform was unknown.
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for PlatformSpecSummary
impl Send for PlatformSpecSummary
impl Sync for PlatformSpecSummary
impl Unpin for PlatformSpecSummary
impl UnwindSafe for PlatformSpecSummary
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.