Skip to main content

Area

Struct Area 

Source
pub struct Area { /* private fields */ }
Expand description

A part of a panel under {prefix}/{slug} with a sidebar of its own: a settings area, an account area. Registered with Panel::area.

Outside the area, the panel’s sidebar shows the area as one entry, which opens the first of its entries the user may open. Inside it, the sidebar shows a link back to the panel’s home and the area’s groups, each listing the entries the user may open; a group with none is left out. The topbar’s trail starts at the area.

Panel::new("app").area(
    Area::new("settings")
        .group("Account", |group| group.profile().two_factor())
        .tenant_group(|group| group.tenant_profile().resource::<MemberResource>()),
);

Implementations§

Source§

impl Area

Source

pub fn new(slug: impl Into<String>) -> Self

An area at {prefix}/{slug}, with no groups yet. slug is one URL path segment, taken from the namespace the panel’s resources and pages share.

Source

pub fn label(self, label: impl Into<Text>) -> Self

The label of the area’s entry in the panel’s sidebar and of the first step of its trail.

Defaults to the message area-{slug} of the panel’s catalogs, else the slug in sentence case: settings reads area-settings, else Settings.

Source

pub fn icon(self, icon: IconData) -> Self

The icon of the area’s entry in the panel’s sidebar.

Source

pub fn navigation_order(self, order: i32) -> Self

Where the area’s entry sorts among the panel’s sidebar entries, lowest first; defaults to 0, as PageDef::navigation_order does.

Source

pub fn navigation_group(self, group: impl Into<Text>) -> Self

The labelled sidebar group the area’s entry renders in; defaults to none, above every group, as PageDef::navigation_group does.

Source

pub fn without_navigation(self) -> Self

Keeps the area’s entry out of the panel’s sidebar. The area stays mounted: the user menu and the tenant menu lead into it through the profile and tenant settings pages it holds, or a link of the app’s own.

Source

pub fn group( self, label: impl Into<Text>, build: impl FnOnce(AreaGroup) -> AreaGroup, ) -> Self

Adds a group headed label, after the groups already declared, holding what build registers in it.

Source

pub fn tenant_group(self, build: impl FnOnce(AreaGroup) -> AreaGroup) -> Self

Adds a group headed by the name of the tenant the request acts for, after the groups already declared, holding what build registers in it: the tenant’s settings, members and billing. A request that acts for no tenant sees none of its entries.

Trait Implementations§

Source§

impl Debug for Area

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Area

§

impl !Sync for Area

§

impl !UnwindSafe for Area

§

impl Forget for Area

§

impl Freeze for Area

§

impl Move for Area

§

impl Send for Area

§

impl Unpin for Area

§

impl UnsafeUnpin for Area

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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