pub trait View: Send + Sync {
// Required methods
fn route(&self) -> &'static str;
fn heading(&self) -> &'static str;
fn listed(&self) -> bool;
fn param_keys(&self, ctx: &Context) -> Result<Vec<String>, ApiError>;
fn handle_get(
&self,
query: &BTreeMap<String, String>,
ctx: &Context,
) -> Result<String, ApiError>;
fn handle_action(
&self,
name: &str,
query: &BTreeMap<String, String>,
body: &str,
ctx: &Context,
) -> Result<String, ApiError>;
}Expand description
The object-safe façade the router dispatches through, as crate::Table
is for tables. A blanket implementation covers every ViewLogic, so
nothing outside this module implements it.
Required Methods§
Sourcefn route(&self) -> &'static str
fn route(&self) -> &'static str
The route segment, from ViewLogic::name.
Sourcefn heading(&self) -> &'static str
fn heading(&self) -> &'static str
The shell’s heading, from ViewLogic::title.
Sourcefn listed(&self) -> bool
fn listed(&self) -> bool
Whether the switcher lists this view, from ViewLogic::in_switcher.
Sourcefn param_keys(&self, ctx: &Context) -> Result<Vec<String>, ApiError>
fn param_keys(&self, ctx: &Context) -> Result<Vec<String>, ApiError>
The keys of the parameters this view declares, which the server checks against the ones the address itself uses.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".