This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::any::Any; | |
| use std::collections::HashMap; | |
| struct VecStorage<T> { | |
| list: Vec<T>, | |
| } | |
| trait Component: Any + Sized { | |
| type Storage: Any + Send + Sync; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct TypeName { | |
| path: &'static str, | |
| name: &'static str, | |
| lifetimes: Vec<&'static str>, | |
| generics: Option<TypeName>, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct TypeName<'a> { | |
| path: Option<&'static str>, | |
| name: &'static str, | |
| generics: &'a [TypeName<'a>], | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct TypeName<'a> { | |
| path: Option<&'static str>, | |
| name: &'static str, | |
| lifetimes: &'a [&'static str], | |
| generics: &'a [TypeName<'a>], | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| ComponentName: | |
| field1: true | |
| field2: 0.5 | |
| OtherComponentName: | |
| field3: [1, 3, 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait Serializer<T> { | |
| /// Serialize a part of the world into a buffer. | |
| fn serialize(&World, &mut T) { } | |
| /// Deserialize a part of the world from a buffer. | |
| fn deserialize(&mut World, &T) { } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pub struct TrackedStorage<F: Component + Default, C: Component, S: UnprotectedStorage<C> + Any + Send + Sync> { | |
| inner_storage: S, | |
| flag: PhantomData<F>, | |
| comp: PhantomData<C>, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| examples/check.rs | |
| --- | |
| #[derive(Debug)] | |
| pub struct ExampleComp1 { | |
| field: bool, | |
| } | |
| impl Component for ExampleComp1 { | |
| type Storage = VecStorage<ExampleComp1>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Helper function for serializing entire storages. | |
| pub fn serialize_storage<C, S>(storage: &Store<C>, serializer: &mut S) -> Result<(), SerializeError> | |
| where C: Component + serde::Serialize + fmt::Debug, | |
| S: serde::Serializer, { | |
| use ::Join; | |
| use ::bitset::BitSetLike; | |
| // probably use `with_capacity` later | |
| let mut sequence: Vec<Option<&C>> = Vec::new(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| error[E0277]: the trait bound `&mut D: serde::Deserializer` is not satisfied | |
| --> src\registry.rs:81:44 | |
| | | |
| 81 | let deserialized: Vec<Option<C>> = serde::Deserialize::deserialize(&mut deserializer).unwrap(); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::Deserializer` is not implemented for `&mut D` | |
| | | |
| = help: consider adding a `where &mut D: serde::Deserializer` bound | |
| = note: required by `serde::Deserialize::deserialize` | |
| pub fn deserialize_storage<C, D, R>(storage: &mut Store<C>, deserializer: &mut D, entities: &[Entity]) -> Result<(), SerializeError> |
OlderNewer