Enum guppy::platform::PlatformSpecSummary
source · [−]pub enum PlatformSpecSummary {
Always,
Platform(PlatformSummary),
Any,
}
Expand description
A serializable version of PlatformSpec
.
Requires the summaries
feature to be enabled.
Variants
Always
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(),
}));
Any
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
sourceimpl PlatformSpecSummary
impl PlatformSpecSummary
sourcepub fn new(platform_spec: &PlatformSpec) -> Self
Available on crate feature summaries
only.
pub fn new(platform_spec: &PlatformSpec) -> Self
summaries
only.Creates a new PlatformSpecSummary
from a PlatformSpec
.
sourcepub fn to_platform_spec(&self) -> Result<PlatformSpec, TargetSpecError>
Available on crate feature summaries
only.
pub fn to_platform_spec(&self) -> Result<PlatformSpec, TargetSpecError>
summaries
only.Converts self
to a PlatformSpec
.
Returns an Error
if the platform was unknown.
Trait Implementations
sourceimpl Clone for PlatformSpecSummary
impl Clone for PlatformSpecSummary
sourcefn clone(&self) -> PlatformSpecSummary
fn clone(&self) -> PlatformSpecSummary
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PlatformSpecSummary
impl Debug for PlatformSpecSummary
sourceimpl Default for PlatformSpecSummary
impl Default for PlatformSpecSummary
sourceimpl<'de> Deserialize<'de> for PlatformSpecSummary
impl<'de> Deserialize<'de> for PlatformSpecSummary
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<PlatformSpecSummary> for PlatformSpecSummary
impl PartialEq<PlatformSpecSummary> for PlatformSpecSummary
sourcefn eq(&self, other: &PlatformSpecSummary) -> bool
fn eq(&self, other: &PlatformSpecSummary) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PlatformSpecSummary) -> bool
fn ne(&self, other: &PlatformSpecSummary) -> bool
This method tests for !=
.
sourceimpl Serialize for PlatformSpecSummary
impl Serialize for PlatformSpecSummary
impl Eq for PlatformSpecSummary
impl StructuralEq for PlatformSpecSummary
impl StructuralPartialEq for PlatformSpecSummary
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more