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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
use std::fmt; use std::sync::Arc; use super::{Asset, AssetFormat, Handle, Loader}; pub enum AssetEvent<A, L> where A: Asset, A::Data: AssetFormat<Input = L::Output>, L: Loader, { Load(Handle<A>), Remove(Handle<A>, Arc<A::Data>), FormatError(Handle<A>, <A::Data as AssetFormat>::Error), LoadError(Handle<A>, L::Error), } unsafe impl<A, L> Send for AssetEvent<A, L> where A: Asset, A::Data: AssetFormat<Input = L::Output>, L: Loader, {} unsafe impl<A, L> Sync for AssetEvent<A, L> where A: Asset, A::Data: AssetFormat<Input = L::Output>, L: Loader, {} impl<A, L> fmt::Debug for AssetEvent<A, L> where A: Asset, A::Data: fmt::Debug + AssetFormat<Input = L::Output>, <A::Data as AssetFormat>::Error: fmt::Debug, L: Loader, L::Error: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { &AssetEvent::Load(ref handle) => write!(f, "Load({:?})", handle), &AssetEvent::Remove(ref handle, ref data) => { write!(f, "Remove({:?}, {:?})", handle, &**data) } &AssetEvent::FormatError(ref handle, ref error) => { write!(f, "FormatError({:?}, {:?})", handle, error) } &AssetEvent::LoadError(ref handle, ref error) => { write!(f, "LoadError({:?}, {:?})", handle, error) } } } }