pub struct SurfaceDescriptorBuilder { /* private fields */ }Expand description
Builder for SurfaceDescriptor.
Obtain an instance via SurfaceDescriptor::builder and call build to
finalise the descriptor. Optional fields (required_action
and context_selector) default to None.
build panics if any required field has not been set.
Implementations§
Source§impl SurfaceDescriptorBuilder
impl SurfaceDescriptorBuilder
Sourcepub fn surface_id(self, surface_id: SurfaceId) -> SurfaceDescriptorBuilder
pub fn surface_id(self, surface_id: SurfaceId) -> SurfaceDescriptorBuilder
Sets the surface identifier.
Sourcepub fn label(self, label: impl Into<String>) -> SurfaceDescriptorBuilder
pub fn label(self, label: impl Into<String>) -> SurfaceDescriptorBuilder
Sets the human-readable label.
Sourcepub fn priority(self, priority: i32) -> SurfaceDescriptorBuilder
pub fn priority(self, priority: i32) -> SurfaceDescriptorBuilder
Sets the display priority within the slot.
Sourcepub fn slot(self, slot: impl Into<String>) -> SurfaceDescriptorBuilder
pub fn slot(self, slot: impl Into<String>) -> SurfaceDescriptorBuilder
Sets the slot identifier (e.g. "surface.page").
Sourcepub fn scope(self, scope: Scope) -> SurfaceDescriptorBuilder
pub fn scope(self, scope: Scope) -> SurfaceDescriptorBuilder
Sets the scope (global or tenant).
Sourcepub fn targeting(self, targeting: Targeting) -> SurfaceDescriptorBuilder
pub fn targeting(self, targeting: Targeting) -> SurfaceDescriptorBuilder
Sets the targeting mode.
Sourcepub fn required_action(self, action: Action) -> SurfaceDescriptorBuilder
pub fn required_action(self, action: Action) -> SurfaceDescriptorBuilder
Sets the catalog action required to view this surface (optional). Typed at the declaration site; stored as the canonical action string (actions never cross the service wire as a type).
Sourcepub fn provider_kind(
self,
provider_kind: ProviderKind,
) -> SurfaceDescriptorBuilder
pub fn provider_kind( self, provider_kind: ProviderKind, ) -> SurfaceDescriptorBuilder
Sets the provider kind.
Sourcepub fn required_capabilities(
self,
required_capabilities: CapabilitySet,
) -> SurfaceDescriptorBuilder
pub fn required_capabilities( self, required_capabilities: CapabilitySet, ) -> SurfaceDescriptorBuilder
Sets the set of capabilities this surface requires from the framework.
Sourcepub fn root_node(self, root_node: SurfaceNode) -> SurfaceDescriptorBuilder
pub fn root_node(self, root_node: SurfaceNode) -> SurfaceDescriptorBuilder
Sets the root SurfaceNode of the surface layout.
Sourcepub fn context_selector(
self,
context_selector: SurfaceContextSelectorDescriptor,
) -> SurfaceDescriptorBuilder
pub fn context_selector( self, context_selector: SurfaceContextSelectorDescriptor, ) -> SurfaceDescriptorBuilder
Attaches a context-selector dropdown descriptor to the surface (optional).
Sets the nav icon name (optional; must match a key in the frontend SURFACE_NAV_ICONS allowlist).
Sourcepub fn tab_group(
self,
id: impl Into<String>,
label: impl Into<String>,
) -> SurfaceDescriptorBuilder
pub fn tab_group( self, id: impl Into<String>, label: impl Into<String>, ) -> SurfaceDescriptorBuilder
Groups this surface with others sharing id under one settings tab.
If id matches an existing built-in tab (e.g. "general"), content is appended
to that tab and label is ignored. Otherwise a new tab labelled label is created.
Sourcepub fn build(self) -> SurfaceDescriptor
pub fn build(self) -> SurfaceDescriptor
Consumes the builder and returns the SurfaceDescriptor.
§Panics
Panics if any required field (surface_id, label, priority, slot, scope,
targeting, provider_kind, required_capabilities, root_node) has not been set.
Trait Implementations§
Source§impl Clone for SurfaceDescriptorBuilder
impl Clone for SurfaceDescriptorBuilder
Source§fn clone(&self) -> SurfaceDescriptorBuilder
fn clone(&self) -> SurfaceDescriptorBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more