#[non_exhaustive]pub struct RecordAction {
pub caption: String,
pub id: Option<String>,
pub selection: Selection,
pub enabled: Option<String>,
pub set: String,
pub confirm: Option<String>,
}Expand description
An action of an entity that sets fields of the records selected.
use ravenrs_app::{EntityInfo, FieldInfo, FieldKind, RecordAction};
let task = EntityInfo::new("Task")
.field(FieldInfo::new("id", FieldKind::Integer).key())
.field(FieldInfo::new("state", FieldKind::Text))
.action(
RecordAction::new("Finish")
.enabled("[state] <> 'done'")
.set("state = 'done'")
.confirm("Finish the tasks?"),
);
assert!(task.check().is_ok());Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.caption: StringWhat its button says.
id: Option<String>Its id; Entity.Caption unless given.
selection: SelectionHow many records it takes: one or more unless given.
enabled: Option<String>An expression every record selected has to meet for it to be on.
set: StringWhat it sets: field = expression; ..., each read from the record as it was.
confirm: Option<String>The question asked before it runs.
Implementations§
Source§impl RecordAction
impl RecordAction
Sourcepub fn new(caption: impl Into<String>) -> Self
pub fn new(caption: impl Into<String>) -> Self
An action with this caption, on one record or more, that sets nothing yet.
Sourcepub fn enabled(self, expression: impl Into<String>) -> Self
pub fn enabled(self, expression: impl Into<String>) -> Self
On only while every record selected meets this expression.
Sourcepub fn set(self, assignments: impl Into<String>) -> Self
pub fn set(self, assignments: impl Into<String>) -> Self
What it sets, as field = expression; ....
Sourcepub fn id_on(&self, entity: &EntityInfo) -> String
pub fn id_on(&self, entity: &EntityInfo) -> String
Its id on this entity.
Sourcepub fn to_action(&self, entity: &EntityInfo) -> Action
pub fn to_action(&self, entity: &EntityInfo) -> Action
The action that does it on this entity.
Trait Implementations§
Source§impl Clone for RecordAction
impl Clone for RecordAction
Source§fn clone(&self) -> RecordAction
fn clone(&self) -> RecordAction
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RecordAction
impl Debug for RecordAction
impl Eq for RecordAction
Source§impl PartialEq for RecordAction
impl PartialEq for RecordAction
impl StructuralPartialEq for RecordAction
Auto Trait Implementations§
impl Freeze for RecordAction
impl RefUnwindSafe for RecordAction
impl Send for RecordAction
impl Sync for RecordAction
impl Unpin for RecordAction
impl UnsafeUnpin for RecordAction
impl UnwindSafe for RecordAction
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