EntityCreator

Trait EntityCreator 

Source
pub trait EntityCreator: Send + Sync {
    // Required method
    fn create_from_json<'life0, 'async_trait>(
        &'life0 self,
        entity_data: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for creating entities dynamically

This allows the link system to create new entities with automatic linking without knowing the concrete entity types at compile time.

Required Methods§

Source

fn create_from_json<'life0, 'async_trait>( &'life0 self, entity_data: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new entity from JSON data

§Arguments
  • entity_data - The entity data as JSON
§Returns

The created entity serialized as JSON (with generated ID, timestamps, etc.)

Implementors§