[−][src]Struct autocfg::AutoCfg
Helper to detect compiler features for cfg
output in build scripts.
Methods
impl AutoCfg
[src]
pub fn new() -> Result<Self, Error>
[src]
Create a new AutoCfg
instance.
Common errors
rustc
can't be executed, fromRUSTC
or in thePATH
.- The version output from
rustc
can't be parsed. OUT_DIR
is not set in the environment, or is not a writable directory.
pub fn with_dir<T: Into<PathBuf>>(dir: T) -> Result<Self, Error>
[src]
Create a new AutoCfg
instance with the specified output directory.
Common errors
rustc
can't be executed, fromRUSTC
or in thePATH
.- The version output from
rustc
can't be parsed. dir
is not a writable directory.
pub fn probe_rustc_version(&self, major: usize, minor: usize) -> bool
[src]
Test whether the current rustc
reports a version greater than
or equal to "major
.minor
".
pub fn emit_rustc_version(&self, major: usize, minor: usize)
[src]
Sets a cfg
value of the form rustc_major_minor
, like rustc_1_29
,
if the current rustc
is at least that version.
pub fn probe_path(&self, path: &str) -> bool
[src]
Tests whether the given path can be used.
The test code is subject to change, but currently looks like:
pub use PATH;
pub fn emit_has_path(&self, path: &str)
[src]
Emits a config value has_PATH
if probe_path
returns true.
Any non-identifier characters in the path
will be replaced with
_
in the generated config value.
pub fn emit_path_cfg(&self, path: &str, cfg: &str)
[src]
Emits the given cfg
value if probe_path
returns true.
pub fn probe_trait(&self, name: &str) -> bool
[src]
Tests whether the given trait can be used.
The test code is subject to change, but currently looks like:
pub trait Probe: TRAIT + Sized {}
pub fn emit_has_trait(&self, name: &str)
[src]
Emits a config value has_TRAIT
if probe_trait
returns true.
Any non-identifier characters in the trait name
will be replaced with
_
in the generated config value.
pub fn emit_trait_cfg(&self, name: &str, cfg: &str)
[src]
Emits the given cfg
value if probe_trait
returns true.
pub fn probe_type(&self, name: &str) -> bool
[src]
Tests whether the given type can be used.
The test code is subject to change, but currently looks like:
pub type Probe = TYPE;
pub fn emit_has_type(&self, name: &str)
[src]
Emits a config value has_TYPE
if probe_type
returns true.
Any non-identifier characters in the type name
will be replaced with
_
in the generated config value.
pub fn emit_type_cfg(&self, name: &str, cfg: &str)
[src]
Emits the given cfg
value if probe_type
returns true.
Trait Implementations
impl Clone for AutoCfg
[src]
fn clone(&self) -> AutoCfg
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for AutoCfg
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,