pub struct ExpressionEditor { /* private fields */ }Expand description
An expression editor, as report designers have: the expression in several lines, the fields, parameters, functions, operators and constants that can go in it, a search, the signature and description of the chosen one, and a check as the text changes.
A click on an item shows what it is; a second click, or the insert button, puts it where the caret is. Syntax errors say their line and column; fields, parameters and functions the editor does not know are listed apart, since the expression may still run where they exist.
use ravenrs_reactive::State;
use ravenrs_widgets::{ExpressionEditor, FilterField, FilterFieldKind, Ui};
let expression = State::new("[Quantity] * [UnitPrice]".to_owned());
let editor = ExpressionEditor::new(expression.binding())
.field(FilterField::new("Quantity", "Quantity", FilterFieldKind::Number))
.field(FilterField::new("UnitPrice", "Unit price", FilterFieldKind::Number))
.parameter(FilterField::new("MinTotal", "Least total", FilterFieldKind::Number));
let mut ui = Ui::new(editor, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl ExpressionEditor
impl ExpressionEditor
Sourcepub fn new(value: Binding<String>) -> Self
pub fn new(value: Binding<String>) -> Self
An editor of value, offering the built-in functions, operators and constants.
Sourcepub fn field(self, field: FilterField) -> Self
pub fn field(self, field: FilterField) -> Self
Offers a field, written [name]; a dotted name reads a nested value.
Sourcepub fn fields(self, fields: impl IntoIterator<Item = FilterField>) -> Self
pub fn fields(self, fields: impl IntoIterator<Item = FilterField>) -> Self
Offers these fields.
Sourcepub fn parameter(self, parameter: FilterField) -> Self
pub fn parameter(self, parameter: FilterField) -> Self
Offers a parameter, written ?name.
Sourcepub fn parameters(
self,
parameters: impl IntoIterator<Item = FilterField>,
) -> Self
pub fn parameters( self, parameters: impl IntoIterator<Item = FilterField>, ) -> Self
Offers these parameters.
Trait Implementations§
Source§impl Debug for ExpressionEditor
impl Debug for ExpressionEditor
Auto Trait Implementations§
impl !RefUnwindSafe for ExpressionEditor
impl !Send for ExpressionEditor
impl !Sync for ExpressionEditor
impl !UnwindSafe for ExpressionEditor
impl Freeze for ExpressionEditor
impl Unpin for ExpressionEditor
impl UnsafeUnpin for ExpressionEditor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.