Skip to main content

Layout

Trait Layout 

Source
pub trait Layout:
    Default
    + Sized
    + 'static {
    type Params: PartialEq + 'static;
    type Installs: 'static;

    const DECLARED: Option<Declared> = None;

    // Required methods
    fn install(
        ctx: &FeatureInitContext,
        params: &Self::Params,
    ) -> Result<Self::Installs>;
    fn render(&mut self, cx: &mut LayoutCx<'_, Self>);

    // Provided method
    fn init(_ctx: &FeatureInitContext, _params: &Self::Params) -> Self { ... }
}
Expand description

A branch: draws its own chrome and decides where its child goes. Its own state, the same way a Page is.

Provided Associated Constants§

Source

const DECLARED: Option<Declared> = None

Where impl Layout was written; see Page::DECLARED.

Required Associated Types§

Source

type Params: PartialEq + 'static

What every page under this layout carries, derived by routes! as the intersection of their parameters. A layout declares nothing; it is handed what all of its children were reached with.

Source

type Installs: 'static

What this segment installs, and () when it installs nothing.

The list is not written beside the body - it is the body’s obligation: install returns it, so a feature that stops being installed stops type-checking. Which is also why install has no default any more.

What is returned is owned by the segment’s scope, which is what gives a feature its own lifetime.

Required Methods§

Source

fn install( ctx: &FeatureInitContext, params: &Self::Params, ) -> Result<Self::Installs>

Source

fn render(&mut self, cx: &mut LayoutCx<'_, Self>)

Provided Methods§

Source

fn init(_ctx: &FeatureInitContext, _params: &Self::Params) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§