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>) -> ExpressionEditor
pub fn new(value: Binding<String>) -> ExpressionEditor
An editor of value, offering the built-in functions, operators and constants.
Sourcepub fn field(self, field: FilterField) -> ExpressionEditor
pub fn field(self, field: FilterField) -> ExpressionEditor
Offers a field, written [name]; a dotted name reads a nested value.
Sourcepub fn fields(
self,
fields: impl IntoIterator<Item = FilterField>,
) -> ExpressionEditor
pub fn fields( self, fields: impl IntoIterator<Item = FilterField>, ) -> ExpressionEditor
Offers these fields.
Sourcepub fn parameter(self, parameter: FilterField) -> ExpressionEditor
pub fn parameter(self, parameter: FilterField) -> ExpressionEditor
Offers a parameter, written ?name.
Sourcepub fn parameters(
self,
parameters: impl IntoIterator<Item = FilterField>,
) -> ExpressionEditor
pub fn parameters( self, parameters: impl IntoIterator<Item = FilterField>, ) -> ExpressionEditor
Offers these parameters.
Sourcepub fn rows(self, rows: usize) -> ExpressionEditor
pub fn rows(self, rows: usize) -> ExpressionEditor
How many lines of the expression show before it scrolls (5 by default).
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
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>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.