Skip to main content

Actions

Struct Actions 

Source
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>

Source

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.

Source

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

Source

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.

Source

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)].

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn bind_invocation<C: ActionControl<()>>( &self, control: C, invoke: Invoke<R>, ) -> C

control (a button), bound to one fully specified invocation.

Source

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

Source

pub fn effect<E: Effect>(&self, effect: &E) -> Option<ActionBinding<()>>

The binding of one fully specified effect, for a button.

Source

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.

Source

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§

Source§

impl<R: Resource> Clone for Actions<R>

Source§

fn clone(&self) -> Self

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

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> 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
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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,