Struct cfg_expr::targets::Arch

source ·
pub struct Arch(pub Cow<'static, str>);
Expand description

The “architecture” field

Tuple Fields§

§0: Cow<'static, str>

Implementations§

Constructs a new instance of this field.

This method accepts both owned Strings and &'static strs.

Examples found in repository?
src/expr.rs (lines 440-442)
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
    fn to_pred<'a>(&self, s: &'a str) -> Predicate<'a> {
        use InnerPredicate as IP;
        use Predicate::{
            DebugAssertions, Feature, Flag, KeyValue, ProcMacro, Target, TargetFeature, Test,
        };

        match self {
            IP::Target(it) => match &it.which {
                Which::Abi => Target(TargetPredicate::Abi(targ::Abi::new(
                    s[it.span.clone().unwrap()].to_owned(),
                ))),
                Which::Arch => Target(TargetPredicate::Arch(targ::Arch::new(
                    s[it.span.clone().unwrap()].to_owned(),
                ))),
                Which::Os => Target(TargetPredicate::Os(targ::Os::new(
                    s[it.span.clone().unwrap()].to_owned(),
                ))),
                Which::Vendor => Target(TargetPredicate::Vendor(targ::Vendor::new(
                    s[it.span.clone().unwrap()].to_owned(),
                ))),
                Which::Env => Target(TargetPredicate::Env(targ::Env::new(
                    s[it.span.clone().unwrap()].to_owned(),
                ))),
                Which::Family => Target(TargetPredicate::Family(targ::Family::new(
                    s[it.span.clone().unwrap()].to_owned(),
                ))),
                Which::Endian(end) => Target(TargetPredicate::Endian(*end)),
                Which::HasAtomic(has_atomic) => Target(TargetPredicate::HasAtomic(*has_atomic)),
                Which::Panic => Target(TargetPredicate::Panic(targ::Panic::new(
                    s[it.span.clone().unwrap()].to_owned(),
                ))),
                Which::PointerWidth(pw) => Target(TargetPredicate::PointerWidth(*pw)),
            },
            IP::Test => Test,
            IP::DebugAssertions => DebugAssertions,
            IP::ProcMacro => ProcMacro,
            IP::Feature(rng) => Feature(&s[rng.clone()]),
            IP::TargetFeature(rng) => TargetFeature(&s[rng.clone()]),
            IP::Other { identifier, value } => match value {
                Some(vs) => KeyValue {
                    key: &s[identifier.clone()],
                    val: &s[vs.clone()],
                },
                None => Flag(&s[identifier.clone()]),
            },
        }
    }

Constructs a new instance of this field from a &'static str.

Examples found in repository?
src/targets/builtins.rs (line 2530)
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
    pub const aarch64: Arch = Arch::new_const("aarch64");
    pub const arm: Arch = Arch::new_const("arm");
    pub const avr: Arch = Arch::new_const("avr");
    pub const bpf: Arch = Arch::new_const("bpf");
    pub const hexagon: Arch = Arch::new_const("hexagon");
    pub const m68k: Arch = Arch::new_const("m68k");
    pub const mips: Arch = Arch::new_const("mips");
    pub const mips64: Arch = Arch::new_const("mips64");
    pub const msp430: Arch = Arch::new_const("msp430");
    pub const nvptx64: Arch = Arch::new_const("nvptx64");
    pub const powerpc: Arch = Arch::new_const("powerpc");
    pub const powerpc64: Arch = Arch::new_const("powerpc64");
    pub const riscv32: Arch = Arch::new_const("riscv32");
    pub const riscv64: Arch = Arch::new_const("riscv64");
    pub const s390x: Arch = Arch::new_const("s390x");
    pub const sparc: Arch = Arch::new_const("sparc");
    pub const sparc64: Arch = Arch::new_const("sparc64");
    pub const wasm32: Arch = Arch::new_const("wasm32");
    pub const wasm64: Arch = Arch::new_const("wasm64");
    pub const x86: Arch = Arch::new_const("x86");
    pub const x86_64: Arch = Arch::new_const("x86_64");

Returns the string for the field.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.