Function slint_build::compile

source ·
pub fn compile(path: impl AsRef<Path>) -> Result<(), CompileError>
Expand description

Compile the .slint file and generate rust code for it.

The generated code code will be created in the directory specified by the OUT environment variable as it is expected for build script.

The following line need to be added within your crate in order to include the generated code.

slint::include_modules!();

The path is relative to the CARGO_MANIFEST_DIR.

In case of compilation error, the errors are shown in stderr, the error are also returned in the CompileError enum. You must unwrap the returned result to make sure that cargo make the compilation fail in case there were errors when generating the code.

Please check out the documentation of the slint crate for more information about how to use the generated code.