Skip to main content

Features

Struct Features 

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

Which functions the built catalogs may use, and which locale data they need.

Implementations§

Source§

impl Features

Source

pub fn from_env() -> Features

The set cargo passed this build.rs: every CARGO_FEATURE_* in the environment, back in its kebab-case spelling.

Cargo spells a feature some-feature as CARGO_FEATURE_SOME_FEATURE, so a feature whose name already holds _ comes back with -. None of the facade’s features does (plans/00-master-plan.md §5).

Source

pub fn from_vars(vars: impl IntoIterator<Item = (String, String)>) -> Features

Features::from_env over a given environment, for tests.

Source

pub fn parse(list: &str) -> Features

The set a --features argument names: comma- or space-separated, with crate/feature reduced to feature as cargo reads it.

Source

pub fn from_names<S: Into<String>>( names: impl IntoIterator<Item = S>, ) -> Features

A set from names, for tests and mf2 compile.

Source

pub fn for_catalogs(&self) -> Features

Only the [CATALOG_FEATURES] of this set: what mf2 compile --site compares with the i18n crate’s.

Source

pub fn has(&self, name: &str) -> bool

Whether name is on.

Source

pub fn names(&self) -> impl Iterator<Item = &str>

The names, sorted.

Source

pub fn fn_number(&self) -> bool

Number localization: symbols, grouping, numbering systems, and :percent / :currency / :unit.

Source

pub fn fn_datetime(&self) -> bool

The date and time family.

Source

pub fn datetime_icu(&self) -> bool

Dates over ICU4X, from the catalog’s icu.blob.

Source

pub fn datetime_intl(&self) -> bool

Dates over the browser’s Intl.DateTimeFormat.

Source

pub fn intl(&self) -> bool

Numbers, plural selection and dates through the browser’s Intl on the client (D4). The server keeps the Rust path, so a catalog still carries the data unless the build writes a client variant.

Source

pub fn provides(&self, identifier: &str) -> Option<bool>

Whether this build provides the built-in function identifier (an MF2 identifier without its :), or None if it is not a built-in — a custom function, which [functions] in mf2.toml answers for.

Source

pub fn missing_feature(&self, identifier: &str) -> Option<&'static str>

The feature identifier needs and this build does not have.

Trait Implementations§

Source§

impl Clone for Features

Source§

fn clone(&self) -> Self

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 Debug for Features

Source§

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

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

impl Default for Features

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Features

Source§

impl PartialEq for Features

Source§

fn eq(&self, other: &Self) -> 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 Features

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> ErasedDestructor for T
where T: 'static,

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, 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.