Struct target_features::Target

source ·
pub struct Target { /* private fields */ }
Expand description

A target architecture with optional features.

Implementations§

source§

impl Target

source

pub const fn suggested_simd_width<T: SimdType>(&self) -> Option<usize>

Returns a suggested number of elements for a SIMD vector of the provided type.

The returned value is an approximation and not necessarily indicative of the optimal vector width. A few caveats:

  • Every instruction set is different, and this function doesn’t take into account any particular operations–it’s just a guess, and should be accurate at least for basic arithmetic.
  • Variable length vector instruction sets (ARM SVE and RISC-V V) only return the minimum vector length.
source§

impl Target

source

pub const fn new(architecture: Architecture) -> Self

Create a target with no specified features.

source

pub const fn from_cpu( architecture: Architecture, cpu: &str ) -> Result<Self, UnknownCpu>

Create a target based on a particular CPU.

source

pub const fn architecture(&self) -> Architecture

Returns the target architecture.

source

pub const fn features(&self) -> FeaturesIter

Returns an iterator over the features.

source

pub const fn supports_feature(&self, feature: Feature) -> bool

Returns whether the target supports the specified feature.

source

pub const fn supports_feature_str(&self, feature: &str) -> bool

Returns whether the target supports the specified feature.

§Panics

Panics if the feature doesn’t belong to the target architecture.

source

pub const fn with_feature(self, feature: Feature) -> Self

Add a feature to the target.

§Panics

Panics if the feature doesn’t belong to the target architecture.

source

pub const fn with_feature_str(self, feature: &str) -> Self

Add a feature to the target.

§Panics

Panics if the requested feature name doesn’t exist for the target architecture.

Trait Implementations§

source§

impl Clone for Target

source§

fn clone(&self) -> Target

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Target

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl PartialEq for Target

source§

fn eq(&self, other: &Target) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Target

source§

impl Eq for Target

source§

impl StructuralPartialEq for Target

Auto Trait Implementations§

§

impl Freeze for Target

§

impl RefUnwindSafe for Target

§

impl Send for Target

§

impl Sync for Target

§

impl Unpin for Target

§

impl UnwindSafe for Target

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.