pub trait Conversion: Attributes + ModelNaming {
// Provided methods
fn to_key(&self) -> Option<Vec<Value>> { ... }
fn param_delimiter() -> &'static str { ... }
fn to_param(&self) -> Option<String> { ... }
fn to_partial_path(&self) -> String { ... }
fn model_name_for_conversion() -> &'static str { ... }
}Expand description
Helpers for converting models into routing-friendly representations.
Provided Methods§
Sourcefn to_key(&self) -> Option<Vec<Value>>
fn to_key(&self) -> Option<Vec<Value>>
Returns the model key as a list of values.
The default implementation reads the id attribute and returns it when
present and non-null.
Sourcefn param_delimiter() -> &'static str
fn param_delimiter() -> &'static str
Returns the delimiter used when joining composite key components.
Sourcefn to_param(&self) -> Option<String>
fn to_param(&self) -> Option<String>
Returns a URL-safe parameter string derived from Conversion::to_key.
Sourcefn to_partial_path(&self) -> String
fn to_partial_path(&self) -> String
Returns the partial template path for the model.
Sourcefn model_name_for_conversion() -> &'static str
fn model_name_for_conversion() -> &'static str
Returns the model name used by conversion helpers.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.