pub trait Table: Send + Sync {
// Required methods
fn route(&self) -> &'static str;
fn heading(&self) -> &'static str;
fn data_file(&self) -> &'static str;
fn handle_get(&self, ctx: &Context) -> Result<String, ApiError>;
fn handle_put(&self, ctx: &Context, body: &str) -> Result<String, ApiError>;
fn handle_derive(
&self,
ctx: &Context,
body: &str,
) -> Result<String, ApiError>;
}Expand description
The object-safe façade the router holds. Each method returns the JSON body of one endpoint.
Required Methods§
Sourcefn route(&self) -> &'static str
fn route(&self) -> &'static str
The route segment, from TableLogic::name.
Sourcefn heading(&self) -> &'static str
fn heading(&self) -> &'static str
The shell’s heading, from TableLogic::title.
Sourcefn data_file(&self) -> &'static str
fn data_file(&self) -> &'static str
The file under Data/, from TableLogic::file.
Sourcefn handle_get(&self, ctx: &Context) -> Result<String, ApiError>
fn handle_get(&self, ctx: &Context) -> Result<String, ApiError>
GET /api/<table>: the schema, the stored rows, their derivation, their
validation errors, and any sibling data.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".