Skip to main content

ScannerBuilder

Struct ScannerBuilder 

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

Scanner 的自定义装配器。用 Scanner::builder() 构造。

从空表起步:与 Scanner::default() 的 32 个检测器无关,装多少就是多少; 一个都不装也能 build() 成功,得到的 scanner 恒返回空结果 —— 这是行为不是错误, 自检用 Scanner::detector_names。

Implementations§

Source§

impl ScannerBuilder

Source

pub fn with_detector(self, detector: Box<dyn Detector>) -> Self

追加一个检测器(按调用顺序注册,也决定 scan() 的结果顺序)。

同一个检测器注册两次不报错,scan() 里就会跑两遍、产出两条结果 —— 名字不用于去重(32 个内置检测器名字唯一,由 tests/invariants.rs 钉住)。

Source

pub fn build(self) -> Scanner

产出 scanner。不会失败,也不会补默认检测器(空表就是空 scanner)。

Trait Implementations§

Source§

impl Default for ScannerBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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.