Add support for importing Rust types from another crate Slint compilation (#9329)

To implement an external Slint library, the types and components implemented
in the .slint files needs to be exposed through the Rust crate.
A simple example example/app-library is added to demonstrate how to use this feature.

CC #7060
This commit is contained in:
Benny Sjöstrand 2025-09-16 09:01:44 +02:00 committed by GitHub
parent b23a657c44
commit 0bda0a64eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 766 additions and 42 deletions

View file

@ -10,6 +10,7 @@ mod clip;
mod collect_custom_fonts;
mod collect_globals;
mod collect_init_code;
mod collect_libraries;
mod collect_structs_and_enums;
mod collect_subcomponents;
mod compile_paths;
@ -99,6 +100,7 @@ pub async fn run_passes(
let raw_type_loader =
keep_raw.then(|| crate::typeloader::snapshot_with_extra_doc(type_loader, doc).unwrap());
collect_libraries::collect_libraries(doc);
collect_subcomponents::collect_subcomponents(doc);
lower_tabwidget::lower_tabwidget(doc, type_loader, diag).await;
lower_menus::lower_menus(doc, type_loader, diag).await;
@ -208,6 +210,7 @@ pub async fn run_passes(
}
binding_analysis::binding_analysis(doc, &type_loader.compiler_config, diag);
collect_globals::mark_library_globals(doc);
unique_id::assign_unique_id(doc);
doc.visit_all_used_components(|component| {