Struct guppy::Platform [−][src]
A platform to evaluate target specs against.
Implementations
impl Platform<'static>
[src]
pub fn new(
triple: impl AsRef<str>,
target_features: TargetFeatures
) -> Result<Platform<'static>, Error>
[src]
triple: impl AsRef<str>,
target_features: TargetFeatures
) -> Result<Platform<'static>, Error>
Creates a new Platform
from the given built-in triple and target features.
Returns None
if this platform wasn’t known to target-spec
.
impl<'a> Platform<'a>
[src]
pub fn custom(
target_info: &'a TargetInfo<'a>,
target_features: TargetFeatures
) -> Platform<'a>
[src]
target_info: &'a TargetInfo<'a>,
target_features: TargetFeatures
) -> Platform<'a>
Creates a new, custom platform from a TargetInfo
and target features.
Custom platforms are often found in embedded and similar environments. For built-in
platforms, new
is recommended instead.
pub fn add_flags(
&mut self,
flags: impl IntoIterator<Item = impl Into<Cow<'static, str>>>
)
[src]
&mut self,
flags: impl IntoIterator<Item = impl Into<Cow<'static, str>>>
)
Adds a set of flags to accept.
A flag is a single token like the foo
in cfg(not(foo))
.
A default cargo build
will always evaluate flags to false, but custom wrappers may cause
some flags to evaluate to true. For example, as of version 0.6, cargo web build
will cause
cargo_web
to evaluate to true.
pub fn triple(&self) -> &'a str
[src]
Returns the target triple for this platform.
pub fn flags(&self) -> impl Iterator<Item = &str>
[src]
Returns the set of flags enabled for this platform.
pub fn has_flag(&self, flag: impl AsRef<str>) -> bool
[src]
Returns true if this flag was set with add_flags
.
pub fn target_info(&self) -> &'a TargetInfo<'a>
[src]
Returns the underlying TargetInfo
.
pub fn target_features(&self) -> &TargetFeatures
[src]
Returns the set of target features for this platform.
pub fn is_custom(&self) -> bool
[src]
Returns true if this is a custom platform, created by Platform::custom
.
impl Platform<'static>
[src]
pub fn current() -> Option<Platform<'static>>
[src]
Returns the current platform, as detected at build time.
This will return None
if the current platform was unknown to this version of
target-spec
.
impl Platform<'static>
[src]
Helpers for property testing
The methods in this section allow Platform
instances to be used in property-based testing
scenarios.
Currently, proptest 1 is supported if the proptest1
feature is enabled.
pub fn strategy(
target_features: impl Strategy<Value = TargetFeatures>
) -> impl Strategy<Value = Platform<'static>>
[src]
target_features: impl Strategy<Value = TargetFeatures>
) -> impl Strategy<Value = Platform<'static>>
Given a way to generate TargetFeatures
instances, this returns a Strategy
that generates
a platform at random.
Requires the proptest1
feature to be enabled.
Examples
use proptest::prelude::*; use target_spec::{Platform, TargetFeatures}; // target_features is a strategy that always produces TargetFeatures::Unknown. let target_features = Just(TargetFeatures::Unknown); let strategy = Platform::strategy(target_features);
pub fn filtered_strategy(
triple_filter: impl Fn(&'static str) -> bool,
target_features: impl Strategy<Value = TargetFeatures>
) -> impl Strategy<Value = Platform<'static>>
[src]
triple_filter: impl Fn(&'static str) -> bool,
target_features: impl Strategy<Value = TargetFeatures>
) -> impl Strategy<Value = Platform<'static>>
A version of strategy
that allows target triples to be filtered.
Requires the proptest1
feature to be enabled.
Trait Implementations
impl<'a> Clone for Platform<'a>
[src]
impl<'a> Debug for Platform<'a>
[src]
impl<'a> Eq for Platform<'a>
[src]
impl<'a> Hash for Platform<'a>
[src]
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a> Ord for Platform<'a>
[src]
pub fn cmp(&self, other: &Platform<'a>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<'a> PartialEq<Platform<'a>> for Platform<'a>
[src]
pub fn eq(&self, other: &Platform<'a>) -> bool
[src]
pub fn ne(&self, other: &Platform<'a>) -> bool
[src]
impl<'a> PartialOrd<Platform<'a>> for Platform<'a>
[src]
pub fn partial_cmp(&self, other: &Platform<'a>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> StructuralEq for Platform<'a>
[src]
impl<'a> StructuralPartialEq for Platform<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Platform<'a>
impl<'a> Send for Platform<'a>
impl<'a> Sync for Platform<'a>
impl<'a> Unpin for Platform<'a>
impl<'a> UnwindSafe for Platform<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T> DefaultFeatures<'a> for T where
T: 'a + Clone + Send + Sync,
[src]
T: 'a + Clone + Send + Sync,
pub fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a> + 'a, Global>
[src]
pub fn self_address_mut(&mut self) -> *mut ()
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, T> NonSyncFeatures<'a> for T where
T: 'a + Clone,
[src]
T: 'a + Clone,
pub fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a> + 'a, Global>
[src]
pub fn self_address_mut(&mut self) -> *mut ()
[src]
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> SafeBorrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_replacement(ptr: &T) -> &T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,