mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-27 18:36:12 +00:00
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
15 lines
590 B
Rust
15 lines
590 B
Rust
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
//! This pass fills the root component library_imports
|
|
use crate::object_tree::Document;
|
|
|
|
pub fn collect_libraries(doc: &mut Document) {
|
|
doc.imports.iter().for_each(|import| {
|
|
if let Some(library_info) = &import.library_info {
|
|
library_info.exports.iter().for_each(|export_name| {
|
|
doc.library_exports.insert(export_name.to_string(), library_info.clone());
|
|
});
|
|
}
|
|
});
|
|
}
|