#[repr(C)]pub struct ComponentMap {
pub libraries: ComponentLibraryVec,
}Expand description
The component map — holds libraries with namespaced components.
Fields§
§libraries: ComponentLibraryVecLibraries indexed by name. “builtin” is always present.
Implementations§
Source§impl ComponentMap
impl ComponentMap
Sourcepub fn get(&self, collection: &str, name: &str) -> Option<&ComponentDef>
pub fn get(&self, collection: &str, name: &str) -> Option<&ComponentDef>
Qualified lookup: “shadcn:avatar” -> finds library “shadcn”, component “avatar”
Sourcepub fn get_unqualified(&self, name: &str) -> Option<&ComponentDef>
pub fn get_unqualified(&self, name: &str) -> Option<&ComponentDef>
Unqualified lookup: “div” -> searches ONLY the “builtin” library.
Sourcepub fn get_by_qualified_name(&self, qualified: &str) -> Option<&ComponentDef>
pub fn get_by_qualified_name(&self, qualified: &str) -> Option<&ComponentDef>
Parse a “collection:name” string into a lookup
Sourcepub fn get_exportable_libraries(&self) -> Vec<&ComponentLibrary>
pub fn get_exportable_libraries(&self) -> Vec<&ComponentLibrary>
Get all libraries that can be exported (user-defined only)
Sourcepub fn all_components(&self) -> Vec<&ComponentDef>
pub fn all_components(&self) -> Vec<&ComponentDef>
Get all component definitions across all libraries
Source§impl ComponentMap
impl ComponentMap
pub fn create() -> ComponentMap
Sourcepub fn with_builtin() -> ComponentMap
pub fn with_builtin() -> ComponentMap
Create a ComponentMap with the 52 built-in HTML element components pre-registered.
Sourcepub fn from_libraries(libs: &ComponentLibraryVec) -> ComponentMap
pub fn from_libraries(libs: &ComponentLibraryVec) -> ComponentMap
Build a ComponentMap from the libraries stored in an AppConfig.
The component_libraries field already contains builtins (registered in
AppConfig::create()) plus any user-added libraries. No merging needed —
add_component_library / add_component handle insertion at registration time.
Trait Implementations§
Source§impl Clone for ComponentMap
impl Clone for ComponentMap
Source§fn clone(&self) -> ComponentMap
fn clone(&self) -> ComponentMap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComponentMap
impl Debug for ComponentMap
Source§impl Default for ComponentMap
impl Default for ComponentMap
Source§fn default() -> ComponentMap
fn default() -> ComponentMap
Returns an empty ComponentMap with no libraries.
Use AppConfig::create() (which registers the 52 builtins via
register_builtin_components) followed by ComponentMap::from_libraries()
to get a fully-populated map.
Auto Trait Implementations§
impl Freeze for ComponentMap
impl RefUnwindSafe for ComponentMap
impl Send for ComponentMap
impl Sync for ComponentMap
impl Unpin for ComponentMap
impl UnsafeUnpin for ComponentMap
impl UnwindSafe for ComponentMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more