Crate structsy

Source
Expand description

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)?;
tx.commit()?;

Re-exports§

pub use internal::Persistent;
pub use internal::PersistentEmbedded;

Modules§

derive
Re Export proc macros
internal
Internal APIs used by the generated code to interact with structsy, not for public use
record
Raw access structures

Structs§

Filter
Generic filter for any Persistent structures
OwnedSytx
Owned transation to use with StructsyTx trait
PrepareOpen
Prepare open of a structsy file, with migrations possibilities
Prepared
Transaction prepared state ready to be committed if the second phase is considered successful
RawIter
Iterator of raw Records
RawPrepare
Prepared state of RawTransaction
RawTransaction
Transaction for save data in a structsy database without the original source code
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
Snapshot
Read data from a snapshot freezed in a specific moment ignoring all the subsequent committed transactions.
SnapshotQuery
A query to be executed on a specific snapshot
Structsy
Main API to persist structs with structsy.
StructsyConfig
Configuration builder for open/create a Structsy file.
StructsyIter
Iterator for query results
StructsyQuery
Query for a persistent struct
StructsyQueryTx
Query for a persistent struct considering in transaction changes.

Enums§

Order
Query ordering
StructsyError
All the possible Structsy errors
ValueMode
Define the behavior of the index in case a key value pair already exists

Traits§

Fetch
Execute a query on structsy or a structsy transaction
IntoResultDeprecated
Operators
And/Or/Not Operators
RawAccess
Trait for data operations that do not require original structs and enums source code.
RawRead
StructsyTx
Transaction behaviour trait.
Sytx

Type Aliases§

SRes