pub trait FieldType:
Send
+ Sync
+ 'static {
// Required methods
fn view_key(&self) -> &'static str;
fn view_model(&self, cx: &FieldCx<'_>) -> FieldVm;
fn render_default(&self, vm: &FieldVm) -> Markup;
// Provided methods
fn resolve_options(
&self,
_raw: &Value,
) -> Result<ResolvedOptions, OptionsError> { ... }
fn intrinsic_rules(&self, _opts: &ResolvedOptions) -> Vec<Rule> { ... }
fn chrome(&self) -> Chrome { ... }
fn assets(&self, _opts: &ResolvedOptions) -> Vec<&'static str> { ... }
}Expand description
A field type: behaviour registered once per string key.
Required Methods§
Sourcefn view_key(&self) -> &'static str
fn view_key(&self) -> &'static str
The stable key for override resolution and default-template selection
(bare like text for core; dotted vendor.name for plugins).
Sourcefn view_model(&self, cx: &FieldCx<'_>) -> FieldVm
fn view_model(&self, cx: &FieldCx<'_>) -> FieldVm
Builds the serialisable presentation payload. Pure, no IO.
Sourcefn render_default(&self, vm: &FieldVm) -> Markup
fn render_default(&self, vm: &FieldVm) -> Markup
The built-in presenter over the view-model (an Askama partial). Not called when an override wins.
Provided Methods§
Sourcefn resolve_options(&self, _raw: &Value) -> Result<ResolvedOptions, OptionsError>
fn resolve_options(&self, _raw: &Value) -> Result<ResolvedOptions, OptionsError>
Types the descriptor’s raw options blob once at boot. A failure aborts boot naming the resource + field. Default: no options.
Sourcefn intrinsic_rules(&self, _opts: &ResolvedOptions) -> Vec<Rule>
fn intrinsic_rules(&self, _opts: &ResolvedOptions) -> Vec<Rule>
Rules this type always contributes, merged before the descriptor’s own
(e.g. the text field’s email input contributes Rule::Email).
Sourcefn assets(&self, _opts: &ResolvedOptions) -> Vec<&'static str>
fn assets(&self, _opts: &ResolvedOptions) -> Vec<&'static str>
Asset-registry keys this type’s control needs on any page that renders it
(a heavy widget’s script/style). The page shell collects, dedupes, and
emits them; keys must exist in the asset registry. Default: none, so a
type whose widget ships in core laterite.js declares nothing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".