Skip to main content

ComponentSpec

Struct ComponentSpec 

Source
pub struct ComponentSpec {
    pub name: &'static str,
    pub export: String,
    pub doc: &'static str,
    pub props: Vec<PropSpec>,
    pub events: Vec<EventSpec>,
    pub methods: Vec<MethodSpec>,
    pub types: TsTypes,
    pub lazy_children: bool,
    pub generic: bool,
}
Expand description

What a component is to JS: its glue and declarations are generated from it (declarations).

Fields§

§name: &'static str

Its registered name: its type’s full path (std::any::type_name), unique within one binary.

§export: String

Its JS export: the type’s own name, the last segment of its path.

§doc: &'static str

Documentation.

§props: Vec<PropSpec>

Its props, slots and children.

§events: Vec<EventSpec>

Its events.

§methods: Vec<MethodSpec>

The methods of its ref.

§types: TsTypes

The named TypeScript types they use.

§lazy_children: bool

JS makes the children only while the view places them (#[prop(lazy)] on its Children): the core tells it with a $children event on the host.

§generic: bool

Its props are generic over T, the type of the rows one takes (#[props(generic)]), as a component with super::Items is.

Implementations§

Source§

impl ComponentSpec

Source

pub fn host_props(&self) -> impl Iterator<Item = &'static str> + '_

The HOST_PROPS JS sets on its host: those it does not declare itself. Its own prop or event of a host prop’s name is the one apps get (DataTable’s onContextMenu reports a row and column).

Source

pub fn slots(&self) -> impl Iterator<Item = &'static str> + '_

Its named slots.

Source

pub fn renderers(&self) -> impl Iterator<Item = &'static str> + '_

Its render functions (PropKind::Renderer).

Source

pub fn takes_children(&self) -> bool

Whether it takes JSX children.

Source

pub fn items(&self) -> Option<&'static str>

Its PropKind::Items prop (one at most).

Trait Implementations§

Source§

impl Clone for ComponentSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ComponentSpec

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for ComponentSpec

§

impl Freeze for ComponentSpec
where &'static str: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<PropSpec>: Freeze, PhantomData<EventSpec>: Freeze, PhantomData<MethodSpec>: Freeze, *const LeafNode<&'static str, String> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(&'static str, String)>>: Freeze,

§

impl Move for ComponentSpec

§

impl RefUnwindSafe for ComponentSpec

§

impl Send for ComponentSpec
where &'static str: Send, RawVecInner: Send, NodeRef<Owned, &'static str, String, LeafOrInternal>: Send, BoxRaw<(&'static str, String)>: Send,

§

impl Sync for ComponentSpec
where RawVecInner: Sync, NodeRef<Owned, &'static str, String, LeafOrInternal>: Sync, BoxRaw<(&'static str, String)>: Sync,

§

impl Unpin for ComponentSpec
where &'static str: Unpin, *const u8 is !null: Unpin, *const LeafNode<&'static str, String> is !null: Unpin, Box<(&'static str, String)>: Unpin,

§

impl UnsafeUnpin for ComponentSpec

§

impl UnwindSafe for ComponentSpec
where &'static str: UnwindSafe, RawVecInner: UnwindSafe, BTreeMap<&'static str, String>: UnwindSafe,

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

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.