fn serialize_recursive<S>(
        &self,
        entities: &EntitiesRes,
        markers: &mut WriteStorage<M>,
        allocator: &mut M::Allocator,
        serializer: S,
    ) -> Result<S::Ok, S::Error>
    where
        E: Display,
        M: Marker,
        S: Serializer,
    {
        let mut serseq = serializer.serialize_seq(None)?;
        let mut to_serialize: Vec<(Entity, M)> = (entities, &*markers)
            .join()
            .map(|(e, m)| (e, m.clone()))
            .collect();
        while !to_serialize.is_empty() {
            let mut add = vec![];
            {
                let mut ids = |entity| -> Option<M> {
                    if let Some((marker, added)) = allocator.mark(entity, markers) {
                        if added {
                            add.push((entity, marker.clone()));
                        }
                        Some(marker.clone())
                    } else {
                        None
                    }
                };
                for (entity, marker) in to_serialize {
                    serseq.serialize_element(&EntityData::<M, Self::Data> {
                        marker,
                        components: self
                            .serialize_entity(entity, &mut ids)
                            .map_err(ser::Error::custom)?,
                    })?;
                }
            }
            to_serialize = add;
        }
        serseq.end()
    }
/// Serialize components from specified storages
/// of all marked entities with provided serializer.
/// When the component gets serialized the closure passed
/// in `ids` argument marks unmarked `Entity` (the marker of which was
/// requested) and it will get serialized recursively.
/// For serializing without such recursion see `serialize` function.
Serialize components from specified storages
of all marked entities with provided serializer.
When the component gets serialized the closure passed
in `ids` argument marks unmarked `Entity` (the marker of which was
requested) and it will get serialized recursively.
For serializing without such recursion see `serialize` function.
Serialize components from specified storages of all marked entities with provided serializer . When the component gets serialized the closure passed in ` ids ` argument marks unmarked ` Entity ` ( the marker of which was requested ) and it will get serialized recursively . For serializing without such recursion see ` serialize ` function .
fn serialize_recursive<S>(
        &self,
        entities: &EntitiesRes,
        markers: &mut WriteStorage<M>,
        allocator: &mut M::Allocator,
        serializer: S,
    ) -> Result<S::Ok, S::Error>
    where
        E: Display,
        M: Marker,
        S: Serializer,
    {
        let mut serseq = serializer.serialize_seq(None)?;
        let mut to_serialize: Vec<(Entity, M)> = (entities, &*markers)
            .join()
            .map(|(e, m)| (e, m.clone()))
            .collect();
        while !to_serialize.is_empty() {
            let mut add = vec![];
            {
                let mut ids = |entity| -> Option<M> {
                    if let Some((marker, added)) = allocator.mark(entity, markers) {
                        if added {
                            add.push((entity, marker.clone()));
                        }
                        Some(marker.clone())
                    } else {
                        None
                    }
                };
                for (entity, marker) in to_serialize {
                    serseq.serialize_element(&EntityData::<M, Self::Data> {
                        marker,
                        components: self
                            .serialize_entity(entity, &mut ids)
                            .map_err(ser::Error::custom)?,
                    })?;
                }
            }
            to_serialize = add;
        }
        serseq.end()
    }
fn serialize_recursive < S > ( & self , entities : & EntitiesRes , markers : & mut WriteStorage < M > , allocator : & mut M :: Allocator , serializer : S , ) -> Result < S :: Ok , S :: Error > where E : Display , M : Marker , S : Serializer , { let mut serseq = serializer . serialize_seq ( None ) ? ; let mut to_serialize : Vec < ( Entity , M ) > = ( entities , & * markers ) . join ( ) . map ( | ( e , m ) | ( e , m . clone ( ) ) ) . collect ( ) ; while ! to_serialize . is_empty ( ) { let mut add = vec ! [ ] ; { let mut ids = | entity | -> Option < M > { if let Some ( ( marker , added ) ) = allocator . mark ( entity , markers ) { if added { add . push ( ( entity , marker . clone ( ) ) ) ; } Some ( marker . clone ( ) ) } else { None } } ; for ( entity , marker ) in to_serialize { serseq . serialize_element ( & EntityData :: < M , Self :: Data > { marker , components : self . serialize_entity ( entity , & mut ids ) . map_err ( ser :: Error :: custom ) ? , } ) ? ; } } to_serialize = add ; } serseq . end ( ) }
Serialize components from specified storages
of all marked entities with provided serializer.
Serialize components from specified storages of all marked entities with provided serializer .
&self
entities
&EntitiesRes
markers
&mut WriteStorage<M>
allocator
&mut M::Allocator
serializer
S