pub struct Probe { /* private fields */ }
Expand description
A probe object, which is used for probing for features.
Create this with ProbeProbeo::new
, and then probe with
one of the probing methods.
Implementations§
Source§impl Probe
impl Probe
Sourcepub fn new() -> Self
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") );
Sourcepub fn probe_type(&self, type_name: &str) -> bool
pub fn probe_type(&self, type_name: &str) -> bool
Sourcepub fn probe_expression(&self, expression: &str) -> bool
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") );
Sourcepub fn probe_result(&self, code: &str) -> Result<bool>
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§
Auto Trait Implementations§
impl Freeze for Probe
impl RefUnwindSafe for Probe
impl Send for Probe
impl Sync for Probe
impl Unpin for Probe
impl UnwindSafe for Probe
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more