pub struct ViewSpec {
pub model: String,
pub default_mode: ViewMode,
pub allowed_modes: Vec<ViewMode>,
pub fields: Vec<FieldViewSpec>,
pub compositions: Vec<CellComposition>,
pub default_filters: Vec<String>,
pub version: u32,
}Expand description
The full visual contract for one model. This is the single source of truth
at render time — no inference, no AI, no guessing happens once a ViewSpec
exists. Inference and the (future) designer only ever produce one of these.
Fields§
§model: StringThe model (admin name) this spec describes.
default_mode: ViewModeThe mode rendered when no ?view= slug is supplied.
allowed_modes: Vec<ViewMode>Modes offered in the switcher. Should always contain default_mode.
fields: Vec<FieldViewSpec>Per-field display configuration, in declaration order.
compositions: Vec<CellComposition>Composed cells that merge several fields into one visual unit.
default_filters: Vec<String>Field names whose filters are open by default. Redundant with the per-field flag but convenient for the designer to reorder.
version: u32Schema version of this saved spec; see VIEW_SPEC_VERSION.
Implementations§
Source§impl ViewSpec
impl ViewSpec
Sourcepub fn list_fields(&self) -> Vec<&FieldViewSpec>
pub fn list_fields(&self) -> Vec<&FieldViewSpec>
Fields that should appear in list/table/card layouts, sorted by
priority then declaration order. Hidden and DetailOnly are dropped.
Sourcepub fn primary_field(&self) -> Option<&FieldViewSpec>
pub fn primary_field(&self) -> Option<&FieldViewSpec>
The primary field, if one is declared. Used as the row/card title.
Sourcepub fn redacted_fields(&self) -> Vec<&str>
pub fn redacted_fields(&self) -> Vec<&str>
Field names that must never reach a template (sensitive/hidden). The renderer uses this to strip values before building any context.
Sourcepub fn resolve_mode(&self, requested: Option<&str>) -> ViewMode
pub fn resolve_mode(&self, requested: Option<&str>) -> ViewMode
Resolve the active mode from an optional query slug, falling back to
the default and rejecting modes not in allowed_modes.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ViewSpec
impl<'de> Deserialize<'de> for ViewSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ViewSpec
impl StructuralPartialEq for ViewSpec
Auto Trait Implementations§
impl Freeze for ViewSpec
impl RefUnwindSafe for ViewSpec
impl Send for ViewSpec
impl Sync for ViewSpec
impl Unpin for ViewSpec
impl UnsafeUnpin for ViewSpec
impl UnwindSafe for ViewSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more