Skip to main content

NumberFunction

Struct NumberFunction 

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

A numeric handler: :number, :integer or :offset.

Trait Implementations§

Source§

impl Clone for NumberFunction

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 Copy for NumberFunction

Source§

impl Debug for NumberFunction

Source§

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

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

impl Function for NumberFunction

Source§

fn resolve<'a>( &self, cx: &FnContext<'_>, operand: Option<&Value<'a>>, options: &Options<'_, 'a>, errs: &mut dyn ErrorSink, ) -> Option<Value<'a>>

Function resolution (formatting.md): operand resolved — a Value::Fallback when it failed to resolve, so the handler decides (plans/03-runtime.md §2.6) — and options resolved with u:id/u:dir removed. None makes the expression a fallback value; the handler has reported why.
Source§

fn formattable( &self, _cx: &FnContext<'_>, value: &Value<'_>, ) -> Result<(), FormatError>

Whether value can be formatted. Err(e): the placeholder is a fallback value and e is reported.
Source§

fn format(&self, cx: &FnContext<'_>, value: &Value<'_>, out: &mut dyn Sink)

Writes value’s formatted text.
Source§

fn format_parts( &self, cx: &FnContext<'_>, value: &Value<'_>, out: &mut dyn SubPartSink, )

Writes value’s formatted sub-parts (none by default).
Source§

fn part_kind(&self) -> &'static str

The type of this handler’s expression parts.
Source§

fn dir(&self, _cx: &FnContext<'_>, _value: &Value<'_>) -> Dir

The direction of value’s formatted text (Default Bidi Strategy); Auto = unknown.
Source§

fn selectable(&self, value: &Value<'_>) -> bool

Whether value supports selection (formatting.md, “Resolve Selectors”). A value that does not matches only *, with Bad Selector.
Source§

fn matches( &self, cx: &FnContext<'_>, value: &Value<'_>, key: &str, errs: &mut dyn ErrorSink, ) -> bool

Match(value, key); key is NFC. Report e.g. Bad Variant Key through errs.
Source§

fn better_than( &self, _cx: &FnContext<'_>, _value: &Value<'_>, key1: &str, key2: &str, ) -> bool

BetterThan(value, key1, key2), for two keys that both match.

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