Struct maturin::BuildContext

source ·
pub struct BuildContext {
Show 21 fields pub target: Target, pub compile_targets: Vec<CompileTarget>, pub project_layout: ProjectLayout, pub pyproject_toml_path: PathBuf, pub pyproject_toml: Option<PyProjectToml>, pub metadata23: Metadata23, 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: Vec<PlatformTag>, pub interpreter: Vec<PythonInterpreter>, pub cargo_metadata: Metadata, pub universal2: bool, pub editable: bool, pub cargo_options: CargoOptions,
}
Expand description

Contains all the metadata required to build the crate

Fields§

§target: Target

The platform, i.e. os and pointer width

§compile_targets: Vec<CompileTarget>

List of Cargo targets to compile

§project_layout: ProjectLayout

Whether this project is pure rust or rust mixed with python

§pyproject_toml_path: PathBuf

The path to pyproject.toml. Required for the source distribution

§pyproject_toml: Option<PyProjectToml>

Parsed pyproject.toml if any

§metadata23: Metadata23

Python Package Metadata 2.3

§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 metadata23

§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

Build artifacts in release mode, with optimizations

§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: Vec<PlatformTag>

Whether to use the the manylinux/musllinux or use the native linux tag (off)

§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

§cargo_options: CargoOptions

Cargo build options

Implementations§

source§

impl BuildContext

source

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.

source

pub fn bridge(&self) -> &BridgeModel

Bridge model

source

pub fn build_source_distribution(&self) -> Result<Option<BuiltWheelMetadata>>

Builds a source distribution and returns the same metadata as BuildContext::build_wheels

source

pub fn get_platform_tag(&self, platform_tags: &[PlatformTag]) -> Result<String>

Returns the platform part of the tag for the wheel name

source

pub fn get_py3_tags(&self, platform_tags: &[PlatformTag]) -> Result<Vec<String>>

Returns the tags for the WHEEL file for cffi wheels

source

pub fn get_universal_tags( &self, platform_tags: &[PlatformTag] ) -> Result<(String, Vec<String>)>

Returns the tags for the platform without python version

source

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

source

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

source

pub fn compile_cdylib( &self, python_interpreter: Option<&PythonInterpreter>, extension_name: Option<&str> ) -> Result<BuildArtifact>

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.

source

pub fn build_cffi_wheel(&self) -> Result<Vec<BuiltWheelMetadata>>

Builds a wheel with cffi bindings

source

pub fn build_uniffi_wheel(&self) -> Result<Vec<BuiltWheelMetadata>>

Builds a wheel with uniffi bindings

source

pub fn build_bin_wheel( &self, python_interpreter: Option<&PythonInterpreter> ) -> Result<Vec<BuiltWheelMetadata>>

Builds a wheel that contains a binary

Runs [auditwheel_rs()] if not deactivated

source

pub fn build_bin_wheels( &self, interpreters: &[PythonInterpreter] ) -> Result<Vec<BuiltWheelMetadata>>

Builds a wheel that contains a binary

Runs [auditwheel_rs()] if not deactivated

Trait Implementations§

source§

impl Clone for BuildContext

source§

fn clone(&self) -> BuildContext

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Chain<T> for T

source§

fn len(&self) -> usize

The number of items that this chain link consists of.
source§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
source§

impl<T> Container<T> for T
where T: Clone,

§

type Iter = Once<T>

An iterator over the items within this container, by value.
source§

fn get_iter(&self) -> <T as Container<T>>::Iter

Iterate over the elements of the container (using internal iteration because GATs are unstable).
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> OrderedContainer<T> for T
where T: Clone,