pub enum PageViewMode {
Auto,
Html,
Api,
}Expand description
The declared mode, stored in cms_page_type.view_mode.
Variants§
Auto
Derive from the template: blank means JSON-only, otherwise HTML.
Html
Force the template path; Accept is ignored.
Api
Serve JSON at the page’s own URL. When the type also has a
template, that template still answers Accept: text/html.
Implementations§
Source§impl PageViewMode
impl PageViewMode
pub fn as_str(self) -> &'static str
Sourcepub fn parse(raw: &str) -> Self
pub fn parse(raw: &str) -> Self
Lenient by design — anything unrecognised reads as Self::Auto.
Unlike crate::view_restriction::RestrictionKind::parse this
returns Self, not Option<Self>: during a rolling deploy an
older binary can meet a row written by a newer one, and falling
back to the “behave exactly as before” mode is strictly safer
than erroring on a page request.
Trait Implementations§
Source§impl Clone for PageViewMode
impl Clone for PageViewMode
impl Copy for PageViewMode
Source§impl Debug for PageViewMode
impl Debug for PageViewMode
Source§impl Default for PageViewMode
impl Default for PageViewMode
Source§impl<'de> Deserialize<'de> for PageViewMode
impl<'de> Deserialize<'de> for PageViewMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PageViewMode
Source§impl PartialEq for PageViewMode
impl PartialEq for PageViewMode
Source§impl Serialize for PageViewMode
impl Serialize for PageViewMode
impl StructuralPartialEq for PageViewMode
Auto Trait Implementations§
impl Forget for PageViewMode
impl Freeze for PageViewMode
impl RefUnwindSafe for PageViewMode
impl Send for PageViewMode
impl Sync for PageViewMode
impl Unpin for PageViewMode
impl UnsafeUnpin for PageViewMode
impl UnwindSafe for PageViewMode
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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.