Struct built::Options
[−]
[src]
pub struct Options { /* fields omitted */ }
Selects which information built
should retrieve and write as Rust code.
Methods
impl Options
[src]
fn set_compiler(&mut self, enabled: bool) -> &mut Self
[src]
Detecting and writing the version of RUSTC
and RUSTDOC
.
Call the values of RUSTC
and RUSTDOC
as provided by Cargo to get a version string. The
result will something like
pub const RUSTC_VERSION: &'static str = "rustc 1.15.0"; pub const RUSTDOC_VERSION: &'static str = "rustdoc 1.15.0";
fn set_git(&mut self, enabled: bool) -> &mut Self
[src]
Detecting and writing the tag or commit id of the crate's git repository (if any).
This option is only available if built
was compiled with the
serialized_git
feature.
Try to open the git-repository at manifest_location
and retrieve HEAD
tag or commit id. The result will be something like
pub const GIT_VERSION: Option<&'static str> = Some("0.1");
Continuous Integration platforms like Travis
and AppVeyor
will
do shallow clones, causing libgit2
to be unable to get a meaningful
result. The GIT_VERSION
will therefor always be None
if a CI-platform
is detected.
fn set_ci(&mut self, enabled: bool) -> &mut Self
[src]
Detecting and writing the Continuous Integration Platforms we are running on.
Detect various CI-platforms (named or not) and write something like
pub const CI_PLATFORM: Option<&'static str> = Some("AppVeyor");
fn set_env(&mut self, enabled: bool) -> &mut Self
[src]
Detecting various information provided through the environment, especially Cargo.
built
writes something like
#[doc="The full version."] pub const PKG_VERSION: &'static str = "1.2.3-rc1"; #[doc="The major version."] pub const PKG_VERSION_MAJOR: &'static str = "1"; #[doc="The minor version."] pub const PKG_VERSION_MINOR: &'static str = "2"; #[doc="The patch version."] pub const PKG_VERSION_PATCH: &'static str = "3"; #[doc="The pre-release version."] pub const PKG_VERSION_PRE: &'static str = "rc1"; #[doc="A colon-separated list of authors."] pub const PKG_AUTHORS: &'static str = "Joe:Bob:Harry:Potter"; #[doc="The name of the package."] pub const PKG_NAME: &'static str = "testbox"; #[doc="The description."] pub const PKG_DESCRIPTION: &'static str = "xobtset"; #[doc="The home page."] pub const PKG_HOMEPAGE: &'static str = "localhost"; #[doc="The target triple that was being compiled for."] pub const TARGET: &'static str = "x86_64-apple-darwin"; #[doc="The host triple of the rust compiler."] pub const HOST: &'static str = "x86_64-apple-darwin"; #[doc="`release` for release builds, `debug` for other builds."] pub const PROFILE: &'static str = "debug"; #[doc="The compiler that cargo resolved to use."] pub const RUSTC: &'static str = "rustc"; #[doc="The documentation generator that cargo resolved to use."] pub const RUSTDOC: &'static str = "rustdoc"; #[doc="Value of OPT_LEVEL for the profile used during compilation."] pub const OPT_LEVEL: u8 = 0; #[doc="The parallelism that was specified during compilation."] pub const NUM_JOBS: u32 = 8; #[doc="Value of DEBUG for the profile used during compilation."] pub const DEBUG: bool = true;
fn set_dependencies(&mut self, enabled: bool) -> &mut Self
[src]
Parsing Cargo.lock
and writing lists of dependencies and their versions.
For this to work, Cargo.lock
needs to actually be there; this is (usually)
only true for executables and not for libraries. Cargo will only create a
Cargo.lock
for the top-level crate in a dependency-tree. In case
of a library, the top-level crate will decide which crate/version
combination to compile and there will be no Cargo.lock
while the library
gets compiled as a dependency.
Parsing Cargo.lock
instead of Cargo.toml
allows us to serialize the
precise versions Cargo chose to compile. One can't, however, distinguish
build-dependencies
, dev-dependencies
and dependencies
. Furthermore,
some dependencies never show up if Cargo had not been forced to
actually use them (e.g. dev-dependencies
with cargo test
never
having been executed).
/// An array of effective dependencies as documented by `Cargo.lock` pub const DEPENDENCIES: [(&'static str, &'static str); 2] = [("built", "0.1.0"), ("time", "0.1.36")]; /// The effective dependencies as a comma-separated string. pub const DEPENDENCIES_STR: &'static str = "built 0.1.0, time 0.1.36";
fn set_features(&mut self, enabled: bool) -> &mut Self
[src]
Writing features enabled during build.
One should not rely on this besides convenient debug output. If the runtime
depends on enabled features, use #[cfg(feature = "foo")]
instead.
/// The features that were enabled during compilation. pub const FEATURES: [&'static str; 2] = ["DEFAULT", "WAYLAND"]; /// The features as a comma-separated string. pub const FEATURES_STR: &'static str = "DEFAULT, WAYLAND";
fn set_time(&mut self, enabled: bool) -> &mut Self
[src]
Writing the current timestamp.
This option is only available if built
is compiled with the
serialized_time
feature.
If built
is included as a runtime-dependency, it can parse the
string-representation into a time:Tm
with the help
of built::util::strptime()
.
/// The built-time in RFC822, UTC pub const BUILT_TIME_UTC: &'static str = "Tue, 14 Feb 2017 01:12:35 GMT";
fn set_cfg(&mut self, enabled: bool) -> &mut Self
[src]
Writing the configuration attributes.
built
writes something like
/// The target architecture, given by `cfg!(target_arch)`. pub const CFG_TARGET_ARCH: &'static str = "x86_64"; /// The endianness, given by `cfg!(target_endian)`. pub const CFG_ENDIAN: &'static str = "little"; /// The toolchain-environment, given by `cfg!(target_env)`. pub const CFG_ENV: &'static str = "gnu"; /// The OS-family, given by `cfg!(target_family)`. pub const CFG_FAMILY: &'static str = "unix"; /// The operating system, given by `cfg!(target_os)`. pub const CFG_OS: &'static str = "linux"; /// The pointer width, given by `cfg!(target_pointer_width)`. pub const CFG_POINTER_WIDTH: &'static str = "64";
Trait Implementations
impl Default for Options
[src]
fn default() -> Options
[src]
A new struct with almost all options enabled.
Parsing and writing information about dependencies is disabled by default
because this information is not available for crates compiled as dependencies;
only the top-level crate gets to do this. See set_dependencies()
for
further information.