assets.rs
1use anyhow::{anyhow, Result};
2use gpui::AssetSource;
3use rust_embed::RustEmbed;
4
5#[derive(RustEmbed)]
6#[folder = "assets"]
7pub struct Assets;
8
9impl AssetSource for Assets {
10 fn load(&self, path: &str) -> Result<std::borrow::Cow<[u8]>> {
11 Self::get(path).ok_or_else(|| anyhow!("could not find asset at path \"{}\"", path))
12 }
13}