Skip to main content

DataSource

Trait DataSource 

Source
pub trait DataSource: Send + Sync {
    // Required methods
    fn action(&self) -> ActionMeta;
    fn fetch(&self, ctx: Ctx, input: Json) -> BoxFuture<Result<Json>>;
}
Expand description

Data a component fetches from the server through an action, such as lookup options or tree children. The server finds it by node path and key, checks the screen’s access, the feature’s guards and the action’s permission, then runs it.

Required Methods§

Source

fn action(&self) -> ActionMeta

Source

fn fetch(&self, ctx: Ctx, input: Json) -> BoxFuture<Result<Json>>

Runs the action with the client’s input. The input is untrusted: it is read as the action’s input type, and anything that does not fit is refused.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<E: Model> DataSource for SearchBox<E>

Source§

impl<M: Model, A> DataSource for SubmitForm<M, A>
where A: Action<Input = Valid<M>>, A::Output: Outcome,

Checks one step of a stepped form: reads every submitted value the way a save would and returns the errors of the step’s fields only. Nothing is saved; the submit action’s permission is required, as for saving.