PartNumberBuilder

Struct PartNumberBuilder 

Source
pub struct PartNumberBuilder<'vf, T: ValueFormatTrait> { /* private fields */ }
Expand description

Builder for FormatPart with type Number.

Implementations§

Source§

impl<'vf, T: ValueFormatTrait> PartNumberBuilder<'vf, T>

Source

pub fn new<'a>(valueformat: &'a mut T) -> Self
where 'a: 'vf,

New builder for the valueformat.

Source

pub fn build(self)

Appends the constructed FormatPart to the original value format.

Source

pub fn if_then<F>(self, test: bool, build: F) -> Self
where F: Fn(Self) -> Self,

Only applies the builder if the test is true.

Source

pub fn decimal_places(self, decimal_places: u8) -> Self

If the number:decimal-places attribute is not specified, the number of decimal places specified by the default table cell style is used.

Source

pub fn fixed_decimal_places(self, decimal_places: u8) -> Self

Sets decimal_places and min_decimal_places to the same value, which in effect always displays the same number of decimals.

Source

pub fn grouping(self) -> Self

The number:grouping attribute specifies whether the integer digits of a number should be grouped using a separator character. The grouping character that is used and the number of digits that are grouped together depends on the language and country of the style.

The defined values for the number:grouping attribute are:

  • false: integer digits of a number are not grouped using a separator character.
  • true: integer digits of a number should be grouped by a separator character. The default value for this attribute is false.
Source

pub fn min_decimal_places(self, min_decimal_places: u8) -> Self

The number:min-decimal-places attribute specifies the minimum number of digits in the decimal part. The value of the number:min-decimal-places attribute shall not be greater than the value of the number:decimal-places 19.343 attribute. If the value of number:min-decimal-places is less than the value of number:decimalplaces, trailing zero digits in decimal places following the position indicated by the value of number:min-decimal-places shall not be displayed.

Source

pub fn min_integer_digits(self, mininteger_digits: u8) -> Self

The number:min-integer-digits attribute specifies the minimum number of integer digits to display in the integer portion of a number, a scientific number, or a fraction. For a number:fraction element, if the number:min-integer-digits attribute is not present, no integer portion is displayed.

Source

pub fn display_factor(self, display_factor: f64) -> Self

The number:display-factor attribute specifies a factor by which each number is scaled (divided) before displaying. The default value for this attribute is 1

Source

pub fn decimal_replacement(self, decimal_replacement: char) -> Self

The number:decimal-replacement attribute specifies a replacement text for decimal places if a number style specifies that decimal places are used but the number displayed is an integer. Note: What replacement text is supported is implementation-dependent

Source

pub fn embedded_text<S: Into<String>>(self, text: S, pos: i32) -> Self

The number:embedded-text element specifies text that is displayed at one specific position within a number.

The number:embedded-text element is usable within the following element:

  • number:number 16.29.3.

The number:embedded-text element has the following attribute:

  • number:position 19.358.

The number:position attribute specifies the position where text appears. The index of a position starts with 1 and is counted by digits from right to left in the integer part of a number, starting left from a decimal separator if one exists, or from the last digit of the number. Text is inserted before the digit at the specified position. If the value of number:position attribute is greater than the value of number:min-integer-digits 19.355 and greater than the number of integer digits in the number, text is prepended to the number.

The number:embedded-text element has no child elements. The number:embedded-text element has character data content

Trait Implementations§

Source§

impl<'vf, T: Debug + ValueFormatTrait> Debug for PartNumberBuilder<'vf, T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'vf, T> Freeze for PartNumberBuilder<'vf, T>

§

impl<'vf, T> RefUnwindSafe for PartNumberBuilder<'vf, T>
where T: RefUnwindSafe,

§

impl<'vf, T> Send for PartNumberBuilder<'vf, T>
where T: Send,

§

impl<'vf, T> Sync for PartNumberBuilder<'vf, T>
where T: Sync,

§

impl<'vf, T> Unpin for PartNumberBuilder<'vf, T>

§

impl<'vf, T> !UnwindSafe for PartNumberBuilder<'vf, T>

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 = Infallible

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.