pub struct Config { /* private fields */ }Expand description
Configuration of the build script.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Constructs default configuration state based on
information in the generated build_script_data.json file
located at the crate root. The caller may change
CppBuildPaths and CppBuildConfig values stored in this object
and call config.run() to apply them.
pub fn set_current_cpp_library_version(&mut self, version: Option<String>)
Sourcepub fn known_targets(&self) -> &[LibraryTarget]
pub fn known_targets(&self) -> &[LibraryTarget]
Returns version of the native C++ library used for generating this crate.
This is the value set with Config::set_cpp_lib_version during generation,
or None if the version was not set.
Sourcepub fn cpp_build_config(&self) -> &CppBuildConfig
pub fn cpp_build_config(&self) -> &CppBuildConfig
Returns current CppBuildConfig data.
Sourcepub fn cpp_build_config_mut(&mut self) -> &mut CppBuildConfig
pub fn cpp_build_config_mut(&mut self) -> &mut CppBuildConfig
Returns mutable CppBuildConfig data.
Sourcepub fn set_cpp_build_config(&mut self, config: CppBuildConfig)
pub fn set_cpp_build_config(&mut self, config: CppBuildConfig)
Sets new CppBuildConfig data.
Sourcepub fn cpp_build_paths(&self) -> &CppBuildPaths
pub fn cpp_build_paths(&self) -> &CppBuildPaths
Returns current CppBuildPaths data.
Sourcepub fn cpp_build_paths_mut(&mut self) -> &mut CppBuildPaths
pub fn cpp_build_paths_mut(&mut self) -> &mut CppBuildPaths
Returns mutable CppBuildPaths data.
Sourcepub fn set_cpp_build_paths(&mut self, config: CppBuildPaths)
pub fn set_cpp_build_paths(&mut self, config: CppBuildPaths)
Sets new CppBuildPaths data.
Sourcepub fn try_run(self) -> Result<()>
pub fn try_run(self) -> Result<()>
Same as run(), but result of the operation is returned to the caller.
Sourcepub fn run(self) -> !
pub fn run(self) -> !
Starts build script with current configuration. The build script performs the following operations:
- Build the C++ wrapper library;
- Generate
ffi.rsfile with actual link attributes; - Determine C++ type sizes on current platform and generate
sized_types.rs; - Report linking information to
cargo.
This function ends the process with the appropriate error code and never returns to the caller.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more