pub struct ResourceTypeListView {
pub items: Vec<ResourceType>,
pub total: usize,
pub filter: Option<String>,
pub data_model: String,
}Expand description
The data a renderer needs to render a resource-type list result.
items is the post-filter, sorted list; total is the pre-filter count
(after any built-ins were appended, before --filter was applied); filter
is the applied substring (if any). Whether built-ins are present is read off
the items themselves (is_builtin), so it is not carried as a separate field.
data_model carries the resolved parent data-model’s name for the prose
header (resource-types in <data_model> on <server>). This is a deliberate
extension beyond ProjectListView/DataModelListView (which carry no parent):
resource-type list is sub-scoped to one data-model, and the name must appear
even when items is empty (so it cannot be derived from items[0].iri).
Threading it through MetaContext was rejected — that struct is auth/server
disclosure only (ADR-0007), so overloading it is a worse coupling than this
explicit field. Tabular and JSON renderers ignore data_model.
Clone is required because the test RecordingRenderer stores the view in
an Option<ResourceTypeListView>.
Fields§
§items: Vec<ResourceType>§total: usizePre-filter total count (after built-ins were appended, before --filter
was applied). Feeds the “(m of total matching …)” prose count line.
filter: Option<String>The --filter substring the user supplied, if any.
data_model: StringThe resolved parent data-model’s NAME, for the prose header. Tabular/json ignore it. See struct-level doc for why this field exists.
Trait Implementations§
Source§impl Clone for ResourceTypeListView
impl Clone for ResourceTypeListView
Source§fn clone(&self) -> ResourceTypeListView
fn clone(&self) -> ResourceTypeListView
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more