Skip to main content

Control

Struct Control 

Source
pub struct Control {
    pub kind: ControlKind,
    pub name: Option<String>,
    pub x: f32,
    pub y: f32,
    pub width: f32,
    pub height: f32,
    pub style_name: Option<String>,
    pub style: Style,
    pub visible: Option<String>,
    pub rules: Vec<FormattingRule>,
}
Expand description

A printable element of a band.

Fields§

§kind: ControlKind

What the control is and its content.

§name: Option<String>

An optional name, shown in the designer and in error messages.

§x: f32

Left edge, from the band’s left.

§y: f32

Top edge, from the band’s top.

§width: f32

Width.

§height: f32

Height before growing.

§style_name: Option<String>

A named style from Report::styles.

§style: Style

Style settings on top of the named style.

§visible: Option<String>

The control is left out when this is false.

§rules: Vec<FormattingRule>

Conditional formatting, applied in order when the condition holds.

Implementations§

Source§

impl Control

Source

pub fn label(text: impl Into<String>) -> Self

A label with fixed text.

Source

pub fn chart( kind: ChartKind, argument: impl Into<String>, value: impl Into<String>, ) -> Self

A chart: one series of value per argument.

Source

pub fn barcode(symbology: Symbology, expression: impl Into<String>) -> Self

A barcode showing the value of expression.

Source

pub fn picture(source: impl Into<String>) -> Self

A picture from a data: address or base64 text.

Text that opens url when clicked.

Source

pub fn bookmark(expression: impl Into<String>, level: u32) -> Self

An outline entry showing the value of expression, at level.

Source

pub fn field(expression: impl Into<String>) -> Self

A label showing the value of expression.

Source

pub fn check_box(expression: &str, text: &str) -> Self

A check box for a boolean expression.

Source

pub fn line() -> Self

A horizontal line.

Source

pub fn rect(radius: f32) -> Self

A rectangle.

Source

pub fn table(table: Table) -> Self

A table.

Source

pub fn at(self, x: f32, y: f32, width: f32, height: f32) -> Self

Positions and sizes the control.

Source

pub fn format(self, format: &str) -> Self

Sets the value format (C2, {0:dd/MM/yyyy}…).

Source

pub fn style_name(self, name: &str) -> Self

Uses a named style.

Source

pub fn style(self, style: Style) -> Self

Sets style settings on the control.

Source

pub fn visible(self, expression: &str) -> Self

Prints the control only when expression is true.

Source

pub fn rule(self, condition: &str, style: Style) -> Self

Adds conditional formatting.

Source

pub fn named(self, name: &str) -> Self

Names the control.

Trait Implementations§

Source§

impl Clone for Control

Source§

fn clone(&self) -> Control

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 Control

Source§

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

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

impl Default for Control

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Control

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Control

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Control

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Control

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
§

impl<T> Brush for T
where T: Clone + PartialEq + Default + Debug,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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