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§
Sourceconst DECLARED: Option<Declared> = None
const DECLARED: Option<Declared> = None
Where impl Layout was written; see Page::DECLARED.
Required Associated Types§
Sourcetype Params: PartialEq + 'static
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.
Sourcetype Installs: 'static
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§
fn install( ctx: &FeatureInitContext, params: &Self::Params, ) -> Result<Self::Installs>
fn render(&mut self, cx: &mut LayoutCx<'_, Self>)
Provided Methods§
Sourcefn init(_ctx: &FeatureInitContext, _params: &Self::Params) -> Self
fn init(_ctx: &FeatureInitContext, _params: &Self::Params) -> Self
See Page::init.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".