pub struct ValueCondition { /* private fields */ }
Expand description

Defines a condition that compares the cell-content with a value.

Implementations§

source§

impl ValueCondition

source

pub fn value_eq<V: Into<Value>>(value: V) -> ValueCondition

Compares the cell-content with a value.

source

pub fn value_ne<V: Into<Value>>(value: V) -> ValueCondition

Compares the cell-content with a value.

source

pub fn value_lt<V: Into<Value>>(value: V) -> ValueCondition

Compares the cell-content with a value.

source

pub fn value_gt<V: Into<Value>>(value: V) -> ValueCondition

Compares the cell-content with a value.

source

pub fn value_le<V: Into<Value>>(value: V) -> ValueCondition

Compares the cell-content with a value.

source

pub fn value_ge<V: Into<Value>>(value: V) -> ValueCondition

Compares the cell-content with a value.

Examples found in repository?
examples/negative_number_red.rs (line 37)
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
pub fn main() -> Result<(), OdsError> {
    let mut wb = WorkBook::new(locale!("de_AT"));

    // positive format
    let mut f_number = ValueFormatNumber::new_localized("num0", locale!("de_AT"));
    f_number
        .part_number()
        .decimal_places(2)
        .min_integer_digits(1)
        .grouping()
        .build();
    let f_number = wb.add_number_format(f_number);

    // negative format
    let mut f_number_red = ValueFormatNumber::new_localized("num0red", locale!("de_AT"));
    f_number_red.part_text("-").build();
    f_number_red
        .part_number()
        .decimal_places(2)
        .min_integer_digits(1)
        .grouping()
        .build();
    f_number_red.set_color(Rgb::new(255, 0, 0));
    f_number_red.push_stylemap(ValueStyleMap::new(ValueCondition::value_ge(0), f_number));
    let f_number_red = wb.add_number_format(f_number_red);

    // cellstyle for this number format
    let s_number = CellStyle::new("num_red", &f_number_red);
    let s_number = wb.add_cellstyle(s_number);

    // ...

    let mut sheet = Sheet::new("sample");

    sheet.set_styled_value(0, 0, 723, &s_number);
    sheet.set_styled_value(1, 0, -723, &s_number);

    wb.push_sheet(sheet);

    write_ods(&mut wb, "examples/neg.ods")?;

    Ok(())
}

Trait Implementations§

source§

impl Clone for ValueCondition

source§

fn clone(&self) -> ValueCondition

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for ValueCondition

source§

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

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

impl Display for ValueCondition

source§

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

Formats the value using the given formatter. 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> ToOwned for T
where T: Clone,

§

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§

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

§

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

§

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.