Skip to main content

Build

Struct Build 

Source
pub struct Build { /* private fields */ }
Expand description

构建配置

Implementations§

Source§

impl Build

Source

pub fn new() -> Self

创建默认构建配置。

默认启用 FAT_RUNTIME(运行时 CPU 特性检测),避免在不支持 AVX-512 的 CPU 上 因预编译二进制包含 AVX-512 指令而导致 SIGILL。

Source

pub fn fat_runtime(&mut self, v: bool) -> &mut Self

启用/禁用 FAT_RUNTIME(运行时 CPU 分发,默认启用)

Source

pub fn avx512(&mut self, v: bool) -> &mut Self

启用 AVX512 指令集支持(x86_64 可选)

Source

pub fn avxvnni(&mut self, v: bool) -> &mut Self

启用 AVX512VBMI 指令集支持(x86_64 可选,依赖 BUILD_AVX512)

Source

pub fn build(&mut self) -> Artifacts

执行 cmake 构建,编译 Hyperscan 静态库。

此函数内部:

  1. 调用 cmake::Config::new("hyperscan") 配置构建
  2. 设置必要的 cmake flags(静态库、Release、FAT_RUNTIME 等)
  3. 调用 config.build() 执行编译+安装
  4. 通过 println!("cargo:rustc-link-*") 输出链接指令 (这些指令由调用者进程发出,因此能正确应用到最终二进制)
  5. 返回包含头文件/库文件路径的 Artifacts

Auto Trait Implementations§

§

impl Freeze for Build

§

impl RefUnwindSafe for Build

§

impl Send for Build

§

impl Sync for Build

§

impl Unpin for Build

§

impl UnsafeUnpin 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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.