Struct cfg_expr::targets::Os

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

The “operating system” field, which sometimes implies an environment, and sometimes isn’t an actual operating system.

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 443-445)
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 2569)
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
    pub const android: Os = Os::new_const("android");
    pub const cuda: Os = Os::new_const("cuda");
    pub const dragonfly: Os = Os::new_const("dragonfly");
    pub const emscripten: Os = Os::new_const("emscripten");
    pub const espidf: Os = Os::new_const("espidf");
    pub const freebsd: Os = Os::new_const("freebsd");
    pub const fuchsia: Os = Os::new_const("fuchsia");
    pub const haiku: Os = Os::new_const("haiku");
    pub const hermit: Os = Os::new_const("hermit");
    pub const horizon: Os = Os::new_const("horizon");
    pub const illumos: Os = Os::new_const("illumos");
    pub const ios: Os = Os::new_const("ios");
    pub const l4re: Os = Os::new_const("l4re");
    pub const linux: Os = Os::new_const("linux");
    pub const macos: Os = Os::new_const("macos");
    pub const netbsd: Os = Os::new_const("netbsd");
    pub const openbsd: Os = Os::new_const("openbsd");
    pub const psp: Os = Os::new_const("psp");
    pub const redox: Os = Os::new_const("redox");
    pub const solaris: Os = Os::new_const("solaris");
    pub const solid_asp3: Os = Os::new_const("solid_asp3");
    pub const tvos: Os = Os::new_const("tvos");
    pub const uefi: Os = Os::new_const("uefi");
    pub const unknown: Os = Os::new_const("unknown");
    pub const vxworks: Os = Os::new_const("vxworks");
    pub const wasi: Os = Os::new_const("wasi");
    pub const watchos: Os = Os::new_const("watchos");
    pub const windows: Os = Os::new_const("windows");
    pub const xous: Os = Os::new_const("xous");

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.