rpstate 0.1.0

Type-safe reactive persistence for Rust GUI apps...
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::{MigrationContext, Result};

pub struct FieldDescriptor {
    pub name: &'static str,
    pub type_hash: u64,
}

pub trait RpStateFields: Sized {
    const FIELDS: &'static [FieldDescriptor];
    const VERSION: u32;
    const PARENT_PREFIX: &'static str;
    const MIGRATION_DEPS: &'static [&'static str];

    fn load_struct(ctx: &mut MigrationContext) -> Result<Self>;

    fn save_struct(&self, ctx: &mut MigrationContext) -> Result<()>;
}