pub trait TryDefault: Sized {
    fn try_default() -> Option<Self> { ... }
}
Expand description

Optional default creation.

This is used to attempt to create resources when they don’t already exist in the world. See Read and Write.

This trait can be derived, so long as the type also has a Default instance: ```rust use apecs::*;

#[derive(Debug, Default, TryDefault, PartialEq)] struct MyVec(Vec);

assert_eq!(MyVec(vec![]), MyVec::try_default().unwrap());


The default implementation of `try_default` returns `None`:
```rust
use apecs::*;

#[derive(Debug, PartialEq)]
struct MyVec(Vec<String>);

impl TryDefault for MyVec {}

assert_eq!(None, MyVec::try_default());

Provided Methods

Implementors