Skip to main content

read_action

Function read_action 

pub fn read_action<P, Q>(
    name: ReadName<'_>,
    operation: &'static str,
    schema: fn() -> &'static Value,
    request: impl Fn(P) -> Q + Send + Sync + 'static,
) -> ActionSpec
where P: DeserializeOwned + JsonSchema, Q: Serialize,
Expand description

The published action of the registered read whose operation is operation. Its parameters are the fields of P as P’s JSON Schema describes them (doc comments, #[schema(range(..))] bounds, choices); a caller’s arguments, bound strictly to them, become a P with serde, and request turns that into the reader’s request. It answers schema, and it is a view of the document: it changes nothing.