Struct maturin::BuildContext
source · [−]pub struct BuildContext {Show 20 fields
pub target: Target,
pub bridge: BridgeModel,
pub project_layout: ProjectLayout,
pub metadata21: Metadata21,
pub crate_name: String,
pub module_name: String,
pub manifest_path: PathBuf,
pub target_dir: PathBuf,
pub out: PathBuf,
pub release: bool,
pub strip: bool,
pub skip_auditwheel: bool,
pub zig: bool,
pub platform_tag: Option<PlatformTag>,
pub cargo_extra_args: Vec<String>,
pub rustc_extra_args: Vec<String>,
pub interpreter: Vec<PythonInterpreter>,
pub cargo_metadata: Metadata,
pub universal2: bool,
pub editable: bool,
}
Expand description
Contains all the metadata required to build the crate
Fields
target: Target
The platform, i.e. os and pointer width
bridge: BridgeModel
Whether to use cffi or pyo3/rust-cpython
project_layout: ProjectLayout
Whether this project is pure rust or rust mixed with python
metadata21: Metadata21
Python Package Metadata 2.1
crate_name: String
The name of the crate
module_name: String
The name of the module can be distinct from the package name, mostly because package names normally contain minuses while module names have underscores. The package name is part of metadata21
manifest_path: PathBuf
The path to the Cargo.toml. Required for the cargo invocations
target_dir: PathBuf
Directory for all generated artifacts
out: PathBuf
The directory to store the built wheels in. Defaults to a new “wheels” directory in the project’s target directory
release: bool
Pass –release to cargo
strip: bool
Strip the library for minimum file size
skip_auditwheel: bool
Skip checking the linked libraries for manylinux/musllinux compliance
zig: bool
When compiling for manylinux, use zig as linker to ensure glibc version compliance
platform_tag: Option<PlatformTag>
Whether to use the the manylinux/musllinux or use the native linux tag (off)
cargo_extra_args: Vec<String>
Extra arguments that will be passed to cargo as cargo rustc [...] [arg1] [arg2] --
rustc_extra_args: Vec<String>
Extra arguments that will be passed to rustc as cargo rustc [...] -- [arg1] [arg2]
interpreter: Vec<PythonInterpreter>
The available python interpreter
cargo_metadata: Metadata
Cargo.toml as resolved by cargo_metadata
universal2: bool
Whether to use universal2 or use the native macOS tag (off)
editable: bool
Build editable wheels
Implementations
sourceimpl BuildContext
impl BuildContext
sourcepub fn build_wheels(&self) -> Result<Vec<BuiltWheelMetadata>>
pub fn build_wheels(&self) -> Result<Vec<BuiltWheelMetadata>>
Checks which kind of bindings we have (pyo3/rust-cypthon or cffi or bin) and calls the correct builder.
sourcepub fn build_source_distribution(&self) -> Result<Option<BuiltWheelMetadata>>
pub fn build_source_distribution(&self) -> Result<Option<BuiltWheelMetadata>>
Builds a source distribution and returns the same metadata as BuildContext::build_wheels
sourcepub fn build_binding_wheel_abi3(
&self,
interpreters: &[PythonInterpreter],
major: u8,
min_minor: u8
) -> Result<Vec<BuiltWheelMetadata>>
pub fn build_binding_wheel_abi3(
&self,
interpreters: &[PythonInterpreter],
major: u8,
min_minor: u8
) -> Result<Vec<BuiltWheelMetadata>>
For abi3 we only need to build a single wheel and we don’t even need a python interpreter for it
sourcepub fn build_binding_wheels(
&self,
interpreters: &[PythonInterpreter]
) -> Result<Vec<BuiltWheelMetadata>>
pub fn build_binding_wheels(
&self,
interpreters: &[PythonInterpreter]
) -> Result<Vec<BuiltWheelMetadata>>
Builds wheels for a Cargo project for all given python versions. Return type is the same as BuildContext::build_wheels()
Defaults to 3.{5, 6, 7, 8, 9} if no python versions are given and silently ignores all non-existent python versions.
Runs [auditwheel_rs()] if not deactivated
sourcepub fn compile_cdylib(
&self,
python_interpreter: Option<&PythonInterpreter>,
extension_name: Option<&str>
) -> Result<PathBuf>
pub fn compile_cdylib(
&self,
python_interpreter: Option<&PythonInterpreter>,
extension_name: Option<&str>
) -> Result<PathBuf>
Runs cargo build, extracts the cdylib from the output and returns the path to it
The module name is used to warn about missing a PyInit_<module name>
function for
bindings modules.
sourcepub fn build_cffi_wheel(&self) -> Result<Vec<BuiltWheelMetadata>>
pub fn build_cffi_wheel(&self) -> Result<Vec<BuiltWheelMetadata>>
Builds a wheel with cffi bindings
sourcepub fn build_bin_wheel(&self) -> Result<Vec<BuiltWheelMetadata>>
pub fn build_bin_wheel(&self) -> Result<Vec<BuiltWheelMetadata>>
Builds a wheel that contains a binary
Runs [auditwheel_rs()] if not deactivated
Trait Implementations
sourceimpl Clone for BuildContext
impl Clone for BuildContext
sourcefn clone(&self) -> BuildContext
fn clone(&self) -> BuildContext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for BuildContext
impl Send for BuildContext
impl Sync for BuildContext
impl Unpin for BuildContext
impl UnwindSafe for BuildContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more