pub struct Menu { /* private fields */ }Expand description
A compiled request-local menu with the same four section tokens as PHP.
let menu = MenuBuilder::default().compile("/", false, &Guest);
assert_eq!(menu.section("navbar-user").count(), 0);Implementations§
Source§impl Menu
impl Menu
Sourcepub fn items(&self) -> &[MenuItem]
pub fn items(&self) -> &[MenuItem]
All visible entries, in compilation order, as in AdminLte::menu().
assert!(MenuBuilder::default().compile("/", false, &Guest).items().is_empty());Sourcepub fn section<'a>(
&'a self,
section: &'a str,
) -> impl Iterator<Item = &'a MenuItem> + 'a
pub fn section<'a>( &'a self, section: &'a str, ) -> impl Iterator<Item = &'a MenuItem> + 'a
Filters entries by PHP section. Unknown tokens return the whole menu.
let menu: MenuBuilder = serde_json::from_str(r#"["Reports"]"#)?;
assert_eq!(menu.compile("/", false, &Guest).section("sidebar").count(), 1);Trait Implementations§
Auto Trait Implementations§
impl Forget for Menu
impl Freeze for Menu
impl Move for Menu
impl RefUnwindSafe for Menu
impl Send for Menuwhere
RawVecInner: Send,
impl Sync for Menuwhere
RawVecInner: Sync,
impl Unpin for Menu
impl UnsafeUnpin for Menu
impl UnwindSafe for Menuwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoViewData for Twhere
T: Serialize,
impl<T> IntoViewData for Twhere
T: Serialize,
Source§fn into_view_data(self) -> ViewData
fn into_view_data(self) -> ViewData
Converts the value into view data.