pub type AfterNodeEventFunc<RequestCtx> = fn(_: Vec<Node<RequestCtx>>, _: EventFacade<'_, RequestCtx>) -> BoxFuture<'_, Result<Vec<Node<RequestCtx>>, Error>>;
Expand description

Type alias for a function called after an event affecting a node. The output of this function will be used as the input to the next after event function. If there are no additional after event functions, then the result of this function will be returned as the result for base Warpgrapher create, read, and update operations. For delete operations, the number of nodes deleted will be returned instead.

Examples


fn after_user_create(nodes: Vec<Node<()>>, ef: EventFacade<()>) -> BoxFuture<Result<Vec<Node<()>>, Error>> {
   Box::pin(async move {
      // Normally work would be done here, resulting in some new value.
      Ok(nodes)
   })
}