gpui-ce-motion 0.4.0

Declarative, interruptible animations, transitions, and text motion for GPUI CE
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Embedded SVG assets for the standalone native demos.
use std::borrow::Cow;

pub struct SvgAsset(pub &'static [u8]);

impl gpui::AssetSource for SvgAsset {
    fn load(&self, path: &str) -> gpui::Result<Option<Cow<'static, [u8]>>> {
        Ok((path == "motion.svg").then_some(Cow::Borrowed(self.0)))
    }

    fn list(&self, path: &str) -> gpui::Result<Vec<gpui::SharedString>> {
        Ok(if "motion.svg".starts_with(path) {
            vec!["motion.svg".into()]
        } else {
            Vec::new()
        })
    }
}