Struct nasm_rs::Build

source ·
pub struct Build { /* private fields */ }

Implementations§

source§

impl Build

source

pub fn new() -> Self

source

pub fn file<P: AsRef<Path>>(&mut self, p: P) -> &mut Self

Add a file which will be compiled

e.g. "foo.s"

source

pub fn files<P: AsRef<Path>, I: IntoIterator<Item = P>>( &mut self, files: I ) -> &mut Self

Set multiple files

source

pub fn include<P: AsRef<Path>>(&mut self, dir: P) -> &mut Self

Add a directory to the -I include path

source

pub fn define<'a, V: Into<Option<&'a str>>>( &mut self, var: &str, val: V ) -> &mut Self

Pre-define a macro with an optional value

source

pub fn debug(&mut self, enable: bool) -> &mut Self

Configures whether the assembler will generate debug information.

This option is automatically scraped from the DEBUG environment variable by build scripts (only enabled when the profile is “debug”), so it’s not required to call this function.

source

pub fn flag(&mut self, flag: &str) -> &mut Self

Add an arbitrary flag to the invocation of the assembler

e.g. "-Fdwarf"

source

pub fn target(&mut self, target: &str) -> &mut Self

Configures the target this configuration will be compiling for.

This option is automatically scraped from the TARGET environment variable by build scripts, so it’s not required to call this function.

source

pub fn out_dir<P: AsRef<Path>>(&mut self, out_dir: P) -> &mut Self

Configures the output directory where all object files and static libraries will be located.

This option is automatically scraped from the OUT_DIR environment variable by build scripts, so it’s not required to call this function.

source

pub fn archiver<P: AsRef<Path>>(&mut self, archiver: P) -> &mut Self

Configures the tool used to assemble archives.

This option is automatically determined from the target platform or a number of environment variables, so it’s not required to call this function.

source

pub fn archiver_is_msvc(&mut self, is_msvc: bool) -> &mut Self

Configures the default archiver tool as well as the command syntax.

This option is automatically determined from cfg!(target_env = "msvc"), so it’s not required to call this function.

source

pub fn nasm<P: AsRef<Path>>(&mut self, nasm: P) -> &mut Self

Configures path to nasm command

source

pub fn min_version( &mut self, major: usize, minor: usize, micro: usize ) -> &mut Self

Set the minimum version required

source

pub fn compile(&mut self, lib_name: &str) -> Result<(), String>

Run the compiler, generating the file output

The name output should be the base name of the library, without file extension, and without “lib” prefix.

The output file will have target-specific name, such as lib*.a (non-MSVC) or *.lib (MSVC).

source

pub fn compile_objects(&mut self) -> Result<Vec<PathBuf>, String>

Run the compiler, generating .o files

The files can be linked in a separate step, e.g. passed to cc

Auto Trait Implementations§

§

impl RefUnwindSafe for Build

§

impl Send for Build

§

impl Sync for Build

§

impl Unpin for Build

§

impl UnwindSafe for Build

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.