1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::engine::Engine;
use pill_core::{ PillTypeMap, PillTypeMapKey, PillSlotMapKey };
use std::path::PathBuf;
use anyhow::{Context, Result, Error};
pub trait Resource : PillTypeMapKey {
type Handle: PillSlotMapKey + Send;
fn get_name(&self) -> String;
fn initialize(&mut self, engine: &mut Engine) -> Result<()> { Ok(()) }
fn pass_handle<H: PillSlotMapKey>(&mut self, self_handle: H) {}
fn deferred_update(&mut self, engine: &mut Engine, request: usize) -> Result<()> { Ok(()) }
fn destroy<H: PillSlotMapKey>(&mut self, engine: &mut Engine, self_handle: H) -> Result<()> { Ok(()) }
}
pub enum ResourceLoadType {
Path(PathBuf),
Bytes(Box::<[u8]>),
}