pub struct TypeLoader {
pub global_type_registry: Rc<RefCell<TypeRegister>>,
pub compiler_config: CompilerConfiguration,
pub resolved_style: String,
/* private fields */
}
Fields§
§global_type_registry: Rc<RefCell<TypeRegister>>
§compiler_config: CompilerConfiguration
§resolved_style: String
The style that was specified in the compiler configuration, but resolved. So “native” for example is resolved to the concrete style.
Implementations§
Source§impl TypeLoader
impl TypeLoader
pub fn new( global_type_registry: Rc<RefCell<TypeRegister>>, compiler_config: CompilerConfiguration, diag: &mut BuildDiagnostics, ) -> Self
pub fn drop_document(&mut self, path: &Path) -> Result<(), Error>
Sourcepub fn invalidate_document(&mut self, path: &Path) -> HashSet<PathBuf>
pub fn invalidate_document(&mut self, path: &Path) -> HashSet<PathBuf>
Invalidate a document and all its dependencies.
Sourcepub async fn load_dependencies_recursively<'a>(
&'a mut self,
doc: &'a Document,
diag: &'a mut BuildDiagnostics,
registry_to_populate: &'a Rc<RefCell<TypeRegister>>,
) -> (Vec<ImportedTypes>, Exports)
pub async fn load_dependencies_recursively<'a>( &'a mut self, doc: &'a Document, diag: &'a mut BuildDiagnostics, registry_to_populate: &'a Rc<RefCell<TypeRegister>>, ) -> (Vec<ImportedTypes>, Exports)
Imports of files that don’t have the .slint extension are returned.
pub async fn import_component( &mut self, file_to_import: &str, type_name: &str, diag: &mut BuildDiagnostics, ) -> Option<Rc<Component>>
Sourcepub fn resolve_import_path(
&self,
import_token: Option<&NodeOrToken>,
maybe_relative_path_or_url: &str,
) -> Option<(PathBuf, Option<&'static [u8]>)>
pub fn resolve_import_path( &self, import_token: Option<&NodeOrToken>, maybe_relative_path_or_url: &str, ) -> Option<(PathBuf, Option<&'static [u8]>)>
Append a possibly relative path to a base path. Returns the data if it resolves to a built-in (compiled-in) file.
Sourcepub async fn load_file(
&mut self,
path: &Path,
source_path: &Path,
source_code: String,
is_builtin: bool,
diag: &mut BuildDiagnostics,
)
pub async fn load_file( &mut self, path: &Path, source_path: &Path, source_code: String, is_builtin: bool, diag: &mut BuildDiagnostics, )
Load a file, and its dependency, running only the import passes.
the path must be the canonical path
Sourcepub async fn reload_cached_file(
&mut self,
path: &Path,
diag: &mut BuildDiagnostics,
)
pub async fn reload_cached_file( &mut self, path: &Path, diag: &mut BuildDiagnostics, )
Reload a cached file
The path must be canonical
Sourcepub async fn load_root_file(
&mut self,
path: &Path,
source_path: &Path,
source_code: String,
keep_raw: bool,
diag: &mut BuildDiagnostics,
) -> (PathBuf, Option<TypeLoader>)
pub async fn load_root_file( &mut self, path: &Path, source_path: &Path, source_code: String, keep_raw: bool, diag: &mut BuildDiagnostics, ) -> (PathBuf, Option<TypeLoader>)
Load a file, and its dependency, running the full set of passes.
the path must be the canonical path
Sourcepub fn find_file_in_include_path(
&self,
referencing_file: Option<&Path>,
file_to_import: &str,
) -> Option<(PathBuf, Option<&'static [u8]>)>
pub fn find_file_in_include_path( &self, referencing_file: Option<&Path>, file_to_import: &str, ) -> Option<(PathBuf, Option<&'static [u8]>)>
Lookup a filename and try to find the absolute filename based on the include path or the current file directory
Sourcepub fn get_document<'b>(&'b self, path: &Path) -> Option<&'b Document>
pub fn get_document<'b>(&'b self, path: &Path) -> Option<&'b Document>
Return a document if it was already loaded
Sourcepub fn all_files(&self) -> impl Iterator<Item = &PathBuf>
pub fn all_files(&self) -> impl Iterator<Item = &PathBuf>
Return an iterator over all the loaded file path
Sourcepub fn all_documents(&self) -> impl Iterator<Item = &Document> + '_
pub fn all_documents(&self) -> impl Iterator<Item = &Document> + '_
Returns an iterator over all the loaded documents
Sourcepub fn all_file_documents(
&self,
) -> impl Iterator<Item = (&PathBuf, &Document)> + '_
pub fn all_file_documents( &self, ) -> impl Iterator<Item = (&PathBuf, &Document)> + '_
Returns an iterator over all the loaded documents
Auto Trait Implementations§
impl Freeze for TypeLoader
impl !RefUnwindSafe for TypeLoader
impl !Send for TypeLoader
impl !Sync for TypeLoader
impl Unpin for TypeLoader
impl !UnwindSafe for TypeLoader
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> 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