[][src]Struct amethyst_editor_sync::SerializableEntity

pub struct SerializableEntity(pub Entity);

Helper type that wraps an Entity to provide serialization support.

Entity does not directly implement Serialize because it rarely makes sense to serialize an entity directly. Specs encourages users to treat entities as a collection of components, and to only serialize component data while letting the entity be implicit. For the purposes of the editor, though, we would like to be able to reason about entities directly. SerializableEntity acts as a minimal wrapper around Entity that provides serialization support. You can use it in your components instead of Entity so that you can #[derive(Serialize)] for your component type and display it in the editor.

Note that SerializableEntity does not support deserialization. A robust solution for component deserialization is more complex than what is necessary for the editor at this point. Users interested in full deserialization of entities should have a look at the saveload functionality in specs.

Methods

impl SerializableEntity[src]

pub fn new(entity: Entity) -> Self[src]

Creates a new SerializableEntity from an Entity.

pub fn id(&self) -> u32[src]

Gets the ID of the entity.

pub fn gen(&self) -> Generation[src]

Gets the generation of the entity.

Trait Implementations

impl Copy for SerializableEntity[src]

impl From<Entity> for SerializableEntity[src]

impl From<SerializableEntity> for Entity[src]

impl Clone for SerializableEntity[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for SerializableEntity[src]

impl Serialize for SerializableEntity[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Resource for T where
    T: Any + Send + Sync

impl<T> Any for T where
    T: Any

impl<T> Event for T where
    T: Send + Sync + 'static, 

impl<T> Erased for T

impl<T> Downcast for T where
    T: Any

impl<T> Erased for T