[][src]Crate structsy

Simple single file struct persistence manger

Example

use structsy::{Structsy, StructsyError, StructsyTx};
use structsy_derive::Persistent;
#[derive(Persistent)]
struct MyData {
    name: String,
    address: String,
}
// ......
let db = Structsy::open("my_data.db")?;
db.define::<MyData>()?;

 let my_data = MyData {
   name: "Structsy".to_string(),
   address: "https://gitlab.com/tglman/structsy".to_string(),
};
let mut tx = db.begin()?;
tx.insert(&my_data)?;
db.commit(tx)?;

Structs

FieldDescription

Field metadata for internal use

ImplRef

Internal use implementation reference

OwnedSytx

Owned transation to use with StructsyTx trait

RangeIterator

Iterator implementation for Range of indexed persistent types

RecordIter

Iterator for record instances

Ref

Reference to a record, can be used to load a record or to refer a record from another one.

RefSytx

Reference transaction to use with StructsyTx trait

StructDescription

Struct metadata for internal use

Structsy

Main API for persist structs with structsy.

StructsyConfig

Configuration builder for open/create a Structsy file.

TxRecordIter

Iterator for record instances aware of transactions changes

TxRef

Internal use transaction reference

UniqueRangeIterator

Iterator implementation for Range of unique indexed persistent types

Enums

StructsyError
ValueMode

Define the behavior of the index in case a key value pair already exists

Traits

EmbeddedDescription

Trait for description of embedded structs, automatically generated by structsy_derive.

IndexableValue

Trait implemented by all the values that can be directly indexed.

Persistent

Trait implemented by persistent struct, implementation automatically generated by structsy_derive.

PersistentEmbedded

Base trait implemented by all types that can be persisted inside a struct.

StructsyTx

Transaction behaviour trait.

Sytx

Base transaction trait for internal use.

Functions

declare_index
find
find_range
find_range_tx
find_tx
find_unique
find_unique_range
find_unique_range_tx
find_unique_tx

Type Definitions

SRes