pub struct MenuOptions<'a> {
pub viewer: Option<&'a User>,
pub locale: Option<&'a Locale>,
pub current: Option<&'a Page>,
}Expand description
Everything the resolver needs beyond the menu itself.
A struct rather than three positional Options because every one of
them is optional and independently useful, and three bare Nones at
a call site say nothing about which is which.
Fields§
§viewer: Option<&'a User>#members — hide items whose target page this viewer may not see.
None is an anonymous viewer, which is the safe default: it
hides everything gated rather than revealing it.
locale: Option<&'a Locale>Localize labels. None or the default locale returns canonical
content without issuing the translation queries at all.
current: Option<&'a Page>The page being rendered, for is_active / in_active_trail.
Passed as the row rather than an id because the trail test is a
path prefix comparison, and the caller already holds it.
Trait Implementations§
Source§impl<'a> Clone for MenuOptions<'a>
impl<'a> Clone for MenuOptions<'a>
impl<'a> Copy for MenuOptions<'a>
Source§impl<'a> Debug for MenuOptions<'a>
impl<'a> Debug for MenuOptions<'a>
Auto Trait Implementations§
impl<'a> Forget for MenuOptions<'a>
impl<'a> Freeze for MenuOptions<'a>
impl<'a> RefUnwindSafe for MenuOptions<'a>
impl<'a> Send for MenuOptions<'a>
impl<'a> Sync for MenuOptions<'a>
impl<'a> Unpin for MenuOptions<'a>
impl<'a> UnsafeUnpin for MenuOptions<'a>
impl<'a> UnwindSafe for MenuOptions<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.