pub trait Renderer {
Show 18 methods
// Required methods
fn diagnostic(
&mut self,
diag: &Diagnostic,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn auth_login(
&mut self,
outcome: &AuthLoginOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn auth_status(
&mut self,
outcome: &AuthStatusOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn auth_logout(
&mut self,
outcome: &AuthLogoutOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn auth_set_token(
&mut self,
outcome: &AuthSetTokenOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn project_dump(
&mut self,
outcome: &DumpOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn project_dump_deleted(
&mut self,
outcome: &DumpDeleteOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn projects(
&mut self,
view: &ProjectListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn project_describe(
&mut self,
project: &ProjectDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn data_models(
&mut self,
view: &DataModelListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn data_model_describe(
&mut self,
detail: &DataModelDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn resource_types(
&mut self,
view: &ResourceTypeListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn resource_type_describe(
&mut self,
detail: &ResourceTypeDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn data_model_structure(
&mut self,
structure: &DataModelStructure,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn resources(
&mut self,
view: &ResourceListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn resource_describe(
&mut self,
detail: &ResourceDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn vocabularies(
&mut self,
view: &VocabularyListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
fn vocabulary_describe(
&mut self,
detail: &VocabularyDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>;
}Expand description
The Renderer trait. Methods grow as new noun-groups land.
All methods return Result<(), Diagnostic>. I/O errors in renderer impls
are converted via impl From<std::io::Error> for Diagnostic, which means
writeln!(self.out, "...")?; Just Works against this return type.
Required Methods§
Sourcefn diagnostic(
&mut self,
diag: &Diagnostic,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn diagnostic( &mut self, diag: &Diagnostic, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a diagnostic in the appropriate shape for this format.
Sourcefn auth_login(
&mut self,
outcome: &AuthLoginOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn auth_login( &mut self, outcome: &AuthLoginOutcome, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a successful dsp auth login outcome.
Sourcefn auth_status(
&mut self,
outcome: &AuthStatusOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn auth_status( &mut self, outcome: &AuthStatusOutcome, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp auth status outcome (logged-in or not-logged-in).
Sourcefn auth_logout(
&mut self,
outcome: &AuthLogoutOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn auth_logout( &mut self, outcome: &AuthLogoutOutcome, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp auth logout outcome.
Sourcefn auth_set_token(
&mut self,
outcome: &AuthSetTokenOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn auth_set_token( &mut self, outcome: &AuthSetTokenOutcome, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a successful dsp auth set-token outcome.
Sourcefn project_dump(
&mut self,
outcome: &DumpOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn project_dump( &mut self, outcome: &DumpOutcome, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre project dump outcome.
Sourcefn project_dump_deleted(
&mut self,
outcome: &DumpDeleteOutcome,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn project_dump_deleted( &mut self, outcome: &DumpDeleteOutcome, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre project dump --delete outcome.
outcome.deleted = false means no completed/failed dump existed and a
probe created an in-progress dump — NOT a delete failure (failures are
Err(Diagnostic)).
Sourcefn projects(
&mut self,
view: &ProjectListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn projects( &mut self, view: &ProjectListView, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre project list result (possibly empty).
view carries the items (post-filter, sorted), the pre-filter total,
and the filter string. meta carries auth/server disclosure (dsp-cli/ADR-0007).
Sourcefn project_describe(
&mut self,
project: &ProjectDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn project_describe( &mut self, project: &ProjectDetail, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre project describe result (a single project).
project is passed directly — no view wrapper, since there is no
aggregate context (no total/filter) for a single-object describe.
meta carries auth/server disclosure per dsp-cli/ADR-0007.
Sourcefn data_models(
&mut self,
view: &DataModelListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn data_models( &mut self, view: &DataModelListView, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre data-model list result (possibly empty).
view carries the items (post-filter, sorted), the pre-filter total,
and the filter string. meta carries auth/server disclosure (dsp-cli/ADR-0007).
Sourcefn data_model_describe(
&mut self,
detail: &DataModelDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn data_model_describe( &mut self, detail: &DataModelDetail, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre data-model describe result (a single data-model).
detail is passed directly — no view wrapper, since there is no aggregate
context (no total/filter) for a single-object describe. meta carries
auth/server disclosure per dsp-cli/ADR-0007.
Sourcefn resource_types(
&mut self,
view: &ResourceTypeListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn resource_types( &mut self, view: &ResourceTypeListView, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre resource-type list result (possibly empty).
view carries the items (post-filter, sorted), the pre-filter total, the
filter string, and the parent data-model name. meta carries auth/server
disclosure (dsp-cli/ADR-0007).
Sourcefn resource_type_describe(
&mut self,
detail: &ResourceTypeDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn resource_type_describe( &mut self, detail: &ResourceTypeDetail, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre resource-type describe result (a single resource-type).
detail is passed directly — no view wrapper, since there is no aggregate
context (no total/filter) for a single-object describe. meta carries
auth/server disclosure per dsp-cli/ADR-0007. Built-in field filtering is applied by
the action (via --include-builtins) before this method is called — the
renderer receives only the fields it should render.
Sourcefn data_model_structure(
&mut self,
structure: &DataModelStructure,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn data_model_structure( &mut self, structure: &DataModelStructure, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre data-model structure result (a single data-model’s relations).
structure is passed directly — no view wrapper (describe-shaped, like
data_model_describe). Built-in relation filtering via --include-builtins
is applied by the action before this method is called; the renderer receives
only the relations it should render. meta carries auth/server disclosure
per dsp-cli/ADR-0007.
Sourcefn resources(
&mut self,
view: &ResourceListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn resources( &mut self, view: &ResourceListView, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre resource list result (possibly empty).
view carries the items (post-filter), the pre-filter total, the filter
string, the resource type name, and the pagination state. meta carries
auth/server disclosure (dsp-cli/ADR-0007) including the always-present
filter_warning for instance-side commands (D3).
Sourcefn resource_describe(
&mut self,
detail: &ResourceDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn resource_describe( &mut self, detail: &ResourceDetail, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre resource describe result (a single resource’s envelope).
detail is passed directly — no view wrapper, since there is no aggregate
context for a single-object describe. meta carries auth/server disclosure
per dsp-cli/ADR-0007 including the always-present filter_warning for instance-side
commands (D3).
Sourcefn vocabularies(
&mut self,
view: &VocabularyListView,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn vocabularies( &mut self, view: &VocabularyListView, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre vocabulary list result (possibly empty).
view carries the items (post-filter, sorted by name), the pre-filter
total, the filter string, and whether --count was requested. meta
carries auth/server disclosure (dsp-cli/ADR-0007) plus the --count cost
disclosure (MetaContext.count_cost, plan 034).
Sourcefn vocabulary_describe(
&mut self,
detail: &VocabularyDetail,
meta: &MetaContext,
) -> Result<(), Diagnostic>
fn vocabulary_describe( &mut self, detail: &VocabularyDetail, meta: &MetaContext, ) -> Result<(), Diagnostic>
Render a dsp vre vocabulary describe result (a single vocabulary’s tree).
detail is passed directly — no view wrapper, since there is no
aggregate context for a single-object describe.
This method deliberately INVERTS the established describe convention.
Other describe methods document that “built-in field filtering is
applied by the action … before this method is called — the renderer
receives only the fields it should render” (see resource_type_describe
above). This one is the opposite: it receives the WHOLE tree
(detail.tree, never pruned) and filters to detail.subtree_of’s branch
itself. That is required, not sloppy — pruning before the renderer would
delete the ancestor chain that the absolute number and path columns
are derived from. Do not “fix” this by narrowing the tree in the action
layer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".