use anyhow::{anyhow, Result}; use std::borrow::Cow; pub mod root_view; extern crate warpui; use rust_embed::RustEmbed; use warpui::{platform, AssetProvider}; #[derive(Clone, Copy, RustEmbed)] #[folder = "examples/assets"] pub struct Assets; // The static assets we need to load in app. pub static ASSETS: Assets = Assets; // Implement the AssetProvider trait here (required by App::new). impl AssetProvider for Assets { fn get(&self, path: &str) -> Result> { ::get(path) .map(|f| f.data) .ok_or_else(|| anyhow!("no asset exists at path {}", path)) } } fn main() -> Result<()> { let app_builder = platform::AppBuilder::new(platform::AppCallbacks::default(), Box::new(ASSETS), None); let _ = app_builder.run(move |ctx| { ctx.add_window( warpui::AddWindowOptions { // Set the window background blur radius to 18 pixels. background_blur_radius_pixels: Some(18), ..Default::default() }, |_| root_view::BlurredView {}, ); }); Ok(()) }