pub struct Actions<R: Resource> { /* private fields */ }Expand description
The actions a resource publishes, for binding controls that are built outside the view function: rows a table, list or tree creates on demand. Cheap to clone; clones share the published descriptor.
Implementations§
Source§impl<R: Resource> Actions<R>
impl<R: Resource> Actions<R>
Sourcepub fn operation(&self, decl: &ActionDecl<R>) -> Option<ActionSpec>
pub fn operation(&self, decl: &ActionDecl<R>) -> Option<ActionSpec>
decl — a bound field edit (tilo_resource::ActionDecl::edit,
edit_asking) or verb of another record — as an operation a live
row offers (LiveRow::operation),
carried out on that record as its person (this app’s notification
rule on the app’s row). None for the app’s own resource, whose row
edits are ResourceSurface::row_declarations,
and where the record is read only here.
Sourcepub fn binding<I: 'static>(
&self,
action: impl Binds<R, I>,
) -> Option<ActionBinding<I>>
pub fn binding<I: 'static>( &self, action: impl Binds<R, I>, ) -> Option<ActionBinding<I>>
The binding of action for a control with input I, or None while
the resource does not publish it (an edit bound to view state that
is not there now).
Sourcepub fn invocation(&self, invoke: Invoke<R>) -> Option<ActionBinding<()>>
pub fn invocation(&self, invoke: Invoke<R>) -> Option<ActionBinding<()>>
The binding of one fully specified invocation, for a button, or
None while the resource does not publish it.
Sourcepub fn edit_binding<V: 'static>(
&self,
path: Path<R, V>,
edit: impl Fn(&Path<R, V>, V) -> Edit<R> + Send + Sync + 'static,
) -> Option<ActionBinding<V>>
pub fn edit_binding<V: 'static>( &self, path: Path<R, V>, edit: impl Fn(&Path<R, V>, V) -> Edit<R> + Send + Sync + 'static, ) -> Option<ActionBinding<V>>
The binding of the field at path for a control with input V:
each committed value becomes the field edit edit(path, value).
None, and a failure in tests, when the resource has no field edits
or the field is #[model(readonly)].
Sourcepub fn edit_binding_with<V: 'static, I: 'static>(
&self,
path: Path<R, V>,
edit: impl Fn(&Path<R, V>, I) -> Result<Edit<R>, String> + Send + Sync + 'static,
) -> Option<ActionBinding<I>>
pub fn edit_binding_with<V: 'static, I: 'static>( &self, path: Path<R, V>, edit: impl Fn(&Path<R, V>, I) -> Result<Edit<R>, String> + Send + Sync + 'static, ) -> Option<ActionBinding<I>>
Self::edit_binding for a control whose input I is not the
field’s value: a dropdown of “125%” for a scale of 1.25, a slider’s
position on a log scale. edit maps each committed input to the
field edit, or refuses it, which refuses the input like a value the
field cannot take.
Sourcepub fn set_binding<V, I>(
&self,
path: Path<R, V>,
value: impl Fn(I) -> Result<V, String> + Send + Sync + 'static,
) -> Option<ActionBinding<I>>where
V: Settable + 'static,
I: 'static,
pub fn set_binding<V, I>(
&self,
path: Path<R, V>,
value: impl Fn(I) -> Result<V, String> + Send + Sync + 'static,
) -> Option<ActionBinding<I>>where
V: Settable + 'static,
I: 'static,
The binding of the field at path for a control with input I:
each committed input sets the field to what value makes of it, or is
refused where value refuses it. What a settings row binds; the same
edit as Self::edit_binding_with and Path::set.
Sourcepub fn field_binding<V>(&self, path: Path<R, V>) -> Option<ActionBinding<V>>where
V: Settable + 'static,
pub fn field_binding<V>(&self, path: Path<R, V>) -> Option<ActionBinding<V>>where
V: Settable + 'static,
Self::set_binding of a control whose input is the field’s value.
Sourcepub fn bind<I: 'static, C: ActionControl<I>>(
&self,
control: C,
action: impl Binds<R, I>,
) -> C
pub fn bind<I: 'static, C: ActionControl<I>>( &self, control: C, action: impl Binds<R, I>, ) -> C
control, bound to action. An action the resource does not publish
leaves it disabled, and fails tests and tilo-app check.
Sourcepub fn bind_invocation<C: ActionControl<()>>(
&self,
control: C,
invoke: Invoke<R>,
) -> C
pub fn bind_invocation<C: ActionControl<()>>( &self, control: C, invoke: Invoke<R>, ) -> C
control (a button), bound to one fully specified invocation.
Sourcepub fn effect_binding<E: Effect, I: 'static>(
&self,
effect: impl Binds<E, I>,
) -> Option<ActionBinding<I>>
pub fn effect_binding<E: Effect, I: 'static>( &self, effect: impl Binds<E, I>, ) -> Option<ActionBinding<I>>
The binding of effect effect for a control with input I
(Backups::RESTORE for a dropdown of snapshots).
Sourcepub fn effect<E: Effect>(&self, effect: &E) -> Option<ActionBinding<()>>
pub fn effect<E: Effect>(&self, effect: &E) -> Option<ActionBinding<()>>
The binding of one fully specified effect, for a button.
Sourcepub fn bind_effect<E: Effect, I: 'static, C: ActionControl<I>>(
&self,
control: C,
effect: impl Binds<E, I>,
) -> C
pub fn bind_effect<E: Effect, I: 'static, C: ActionControl<I>>( &self, control: C, effect: impl Binds<E, I>, ) -> C
control, bound to effect effect.
Sourcepub fn bind_effect_invocation<E: Effect, C: ActionControl<()>>(
&self,
control: C,
effect: &E,
) -> C
pub fn bind_effect_invocation<E: Effect, C: ActionControl<()>>( &self, control: C, effect: &E, ) -> C
control (a button), bound to one fully specified effect.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for Actions<R>
impl<R> !RefUnwindSafe for Actions<R>
impl<R> !Send for Actions<R>
impl<R> !Sync for Actions<R>
impl<R> Unpin for Actions<R>
impl<R> UnsafeUnpin for Actions<R>
impl<R> !UnwindSafe for Actions<R>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’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>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more