Skip to main content

ComponentDef

Struct ComponentDef 

Source
pub struct ComponentDef<'a> {
    pub kind: ComponentKind<'a>,
    pub name: Symbol,
    pub props: Vec<(Symbol, &'a TypeExpr<'a>)>,
    pub uses: Vec<Symbol>,
    pub state: Vec<StateField<'a>>,
    pub events: Vec<EventHandler<'a>>,
    pub actions: Vec<ActionDef<'a>>,
    pub view: Option<ViewDef<'a>>,
    pub head: Option<ViewDef<'a>>,
    pub style: Option<StyleBlock>,
    pub span: Span,
}
Expand description

One ## Page / ## Component / ## Store / ## Error page definition.

Fields§

§kind: ComponentKind<'a>§name: Symbol§props: Vec<(Symbol, &'a TypeExpr<'a>)>

Header parameters — a component’s props (## Component Row (todo: Todo)), read-only inside it. A page’s typed path parameters live in its kind.

§uses: Vec<Symbol>

Use Session. — the stores this component reads and calls.

§state: Vec<StateField<'a>>§events: Vec<EventHandler<'a>>§actions: Vec<ActionDef<'a>>§view: Option<ViewDef<'a>>§head: Option<ViewDef<'a>>

Head: — the head HTML this page declares for its own document: its title, description, social card, canonical URL. Rendered at BUILD time into the document the server sends, and merged over the default shell tag by tag, so a page that declares nothing keeps the document it has today.

Only a ## Page can carry one: a component is placed INSIDE a document and does not own it, and two components on one page declaring a title would make the answer depend on render order.

§style: Option<StyleBlock>§span: Span

Implementations§

Source§

impl<'a> ComponentDef<'a>

Source

pub fn label(&self, interner: &Interner) -> String

How a message names this definition: a component by its own name, a page or error page by its header — whose internal name (__page__about) appears nowhere in the source.

Source

pub fn shape(&self, interner: &Interner) -> String

A compact, deterministic one-line rendering — the snapshot surface the parser lock pins and largo expand prints. Bodies print as their statement counts.

Trait Implementations§

Source§

impl<'a> Clone for ComponentDef<'a>

Source§

fn clone(&self) -> ComponentDef<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ComponentDef<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ComponentDef<'a>

§

impl<'a> RefUnwindSafe for ComponentDef<'a>

§

impl<'a> Send for ComponentDef<'a>

§

impl<'a> Sync for ComponentDef<'a>

§

impl<'a> Unpin for ComponentDef<'a>

§

impl<'a> UnsafeUnpin for ComponentDef<'a>

§

impl<'a> UnwindSafe for ComponentDef<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,