Skip to main content

FeatureSet

Struct FeatureSet 

Source
pub struct FeatureSet(/* private fields */);
Expand description

位掩码形式的特性集合。

设计哲学:从极简到丰富、功能可裁剪。默认基线(baseline())只开极简三件套 (include + namespace + implicit-ns),复杂能力(多目标 / glob / 正则 / 扩展名重写)必须显式 @feature enable 才生效,避免重蹈 YAML 过度复杂的覆辙。

Implementations§

Source§

impl FeatureSet

Source

pub fn all() -> FeatureSet

全部特性位(含所有 opt-in 能力)。用于「调用方允许全集」与版本基线, 实际默认并不开启这些——见 FeatureSet::baseline

Source

pub fn baseline() -> FeatureSet

极简默认集(SML 核心可用能力)。这是 parse_file 的默认允许集; 仅「多目标 / glob / 正则 / 扩展名重写」等高级能力需文档内 @feature enable 显式开启(避免重蹈 YAML 覆辙)。

Source

pub fn none() -> FeatureSet

空集合

Source

pub fn for_version(v: Version) -> FeatureSet

按版本基线构造默认特性集:v1 极简默认(baseline)+ 裸词字符串; v2/v3 关闭裸词字符串(须引号)。复杂能力(glob/regex/multi…)仍默认关闭, 需文档 @feature enable 显式开启。

Source

pub fn has(self, f: Feature) -> bool

是否包含某特性

Source

pub fn with(self, f: Feature) -> FeatureSet

返回开启 f 后的副本

Source

pub fn without(self, f: Feature) -> FeatureSet

返回关闭 f 后的副本

Source

pub fn intersection(self, other: FeatureSet) -> FeatureSet

与另一集合取交集(用于「文档裁剪 ∩ 调用方允许」)

Source

pub fn is_empty(self) -> bool

是否无任何特性

Trait Implementations§

Source§

impl Clone for FeatureSet

Source§

fn clone(&self) -> FeatureSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for FeatureSet

Source§

impl Debug for FeatureSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FeatureSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FeatureSet

Source§

impl PartialEq for FeatureSet

Source§

fn eq(&self, other: &FeatureSet) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FeatureSet

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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, <T as TryFrom<U>>::Error>

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.