Skip to main content

ComponentContext

Struct ComponentContext 

Source
pub struct ComponentContext<'a> {
    pub web_config: &'a Value,
    pub item: Option<&'a Value>,
    pub all_items: Option<&'a [Value]>,
    pub popular_ids: Option<&'a [String]>,
}

Fields§

§web_config: &'a Value§item: Option<&'a Value>§all_items: Option<&'a [Value]>§popular_ids: Option<&'a [String]>

Implementations§

Source§

impl<'a> ComponentContext<'a>

Source

pub const fn for_page(web_config: &'a Value) -> ComponentContext<'a>

Source

pub const fn for_content( web_config: &'a Value, item: &'a Value, all_items: &'a [Value], popular_ids: &'a [String], ) -> ComponentContext<'a>

Source

pub const fn for_list( web_config: &'a Value, all_items: &'a [Value], ) -> ComponentContext<'a>

Trait Implementations§

Source§

impl<'a> Debug for ComponentContext<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ComponentContext<'a>

§

impl<'a> RefUnwindSafe for ComponentContext<'a>

§

impl<'a> Send for ComponentContext<'a>

§

impl<'a> Sync for ComponentContext<'a>

§

impl<'a> Unpin for ComponentContext<'a>

§

impl<'a> UnwindSafe for ComponentContext<'a>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.