pub trait ProtoDeserializer: DynClone {
    // Required method
    fn deserialize(&self, data: &str) -> Option<Box<dyn Prototypical>>;
}
Expand description

Defines a method for deserializing a prototype file input.

Required Methods§

source

fn deserialize(&self, data: &str) -> Option<Box<dyn Prototypical>>

Deserializes file input (as a string) into a Prototypical object

Arguments
  • data: The file data as a string

returns: Option<Box<dyn Prototypical, Global>>

Examples
// The default implementation:
use bevy_proto_typetag::{Prototype, Prototypical};
fn example_deserialize(data: &str) -> Option<Box<dyn Prototypical>> {
    if let Ok(value) = serde_yaml::from_str::<Prototype>(data) {
        Some(Box::new(value))
    } else {
        None
   }
}

Trait Implementations§

source§

impl<'clone> Clone for Box<dyn ProtoDeserializer + 'clone>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'clone> Clone for Box<dyn ProtoDeserializer + Send + 'clone>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'clone> Clone for Box<dyn ProtoDeserializer + Send + Sync + 'clone>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'clone> Clone for Box<dyn ProtoDeserializer + Sync + 'clone>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§