Skip to main content

SurfaceDescriptorBuilder

Struct SurfaceDescriptorBuilder 

Source
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_permission and context_selector) default to None.

build panics if any required field has not been set.

Implementations§

Source§

impl SurfaceDescriptorBuilder

Source

pub fn surface_id(self, surface_id: SurfaceId) -> SurfaceDescriptorBuilder

Sets the surface identifier.

Source

pub fn label(self, label: impl Into<String>) -> SurfaceDescriptorBuilder

Sets the human-readable label.

Source

pub fn priority(self, priority: i32) -> SurfaceDescriptorBuilder

Sets the display priority within the slot.

Source

pub fn slot(self, slot: impl Into<String>) -> SurfaceDescriptorBuilder

Sets the slot identifier (e.g. "surface.page").

Source

pub fn scope(self, scope: Scope) -> SurfaceDescriptorBuilder

Sets the scope (global or tenant).

Source

pub fn targeting(self, targeting: Targeting) -> SurfaceDescriptorBuilder

Sets the targeting mode.

Source

pub fn required_permission( self, permission: impl Into<String>, ) -> SurfaceDescriptorBuilder

Sets the permission string required to view this surface (optional).

Source

pub fn provider_kind( self, provider_kind: ProviderKind, ) -> SurfaceDescriptorBuilder

Sets the provider kind.

Source

pub fn required_capabilities( self, required_capabilities: CapabilitySet, ) -> SurfaceDescriptorBuilder

Sets the set of capabilities this surface requires from the framework.

Source

pub fn root_node(self, root_node: SurfaceNode) -> SurfaceDescriptorBuilder

Sets the root SurfaceNode of the surface layout.

Source

pub fn context_selector( self, context_selector: SurfaceContextSelectorDescriptor, ) -> SurfaceDescriptorBuilder

Attaches a context-selector dropdown descriptor to the surface (optional).

Source

pub fn nav_icon(self, nav_icon: impl Into<String>) -> SurfaceDescriptorBuilder

Sets the nav icon name (optional; must match a key in the frontend SURFACE_NAV_ICONS allowlist).

Source

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.

Source

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

Source§

fn clone(&self) -> SurfaceDescriptorBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SurfaceDescriptorBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for SurfaceDescriptorBuilder

Source§

fn default() -> SurfaceDescriptorBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more