Struct feature_probe::Probe [−][src]
pub struct Probe { /* fields omitted */ }
A probe object, which is used for probing for features.
Create this with ProbeProbeo::new
, and then probe with
one of the probing methods.
Methods
impl Probe
[src]
impl Probe
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new Probe
object with a default
configuration.
In particular, it consults the environment variable "RUSTC"
to determine
what Rust compiler to use, and the environment variable "OUT_DIR"
to
determine where to put object files. If these are not set, they default to
the values "rustc"
and "target"
, respectively.
Panics
If the child rustc
cannot be started or communicated with.
Examples
use feature_probe::Probe; let probe = Probe::new(); assert!( probe.probe_type("u32") );
pub fn probe_type(&self, type_name: &str) -> bool
[src]
pub fn probe_type(&self, type_name: &str) -> bool
Probes for the existence of the given type by name.
Panics
If the child rustc
cannot be started or communicated with.
Examples
use feature_probe::Probe; let probe = Probe::new(); assert!( probe.probe_type("u32") ); assert!( ! probe.probe_type("u512") );
pub fn probe_expression(&self, expression: &str) -> bool
[src]
pub fn probe_expression(&self, expression: &str) -> bool
Probes whether the given expression can be compiled.
Examples
use feature_probe::Probe; let probe = Probe::new(); assert!( probe.probe_expression("3 + 4") ); assert!( ! probe.probe_expression("3 + true") );
pub fn probe(&self, code: &str) -> bool
[src]
pub fn probe(&self, code: &str) -> bool
Probes for whether a whole program can be compiled.
Panics
If the child rustc
cannot be started or communicated with.
Examples
use feature_probe::Probe; let probe = Probe::new(); assert!( probe.probe("fn main() { }") ); assert!( ! probe.probe("fn main(args: Vec<String>) { }") );
pub fn probe_result(&self, code: &str) -> Result<bool>
[src]
pub fn probe_result(&self, code: &str) -> Result<bool>
Probes for whether a whole program can be compiled.
Examples
use feature_probe::Probe; let probe = Probe::new(); assert_eq!( probe.probe_result("fn main() { }").unwrap(), true ); assert_eq!( probe.probe_result("fn main(args: Vec<String>) { }").unwrap(), false );
Trait Implementations
impl Debug for Probe
[src]
impl Debug for Probe
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Probe
[src]
impl Default for Probe