import_from_msgpack

Function import_from_msgpack 

Source
pub async fn import_from_msgpack<P: Into<PathBuf>>(
    target: &dyn Memory,
    file_path: P,
) -> Result<usize, String>
Expand description

Imports memory entries from a MessagePack file.

§Arguments

  • target - The target memory backend to write to
  • file_path - Path to the input MessagePack file

§Examples

use ceylon_next::memory::{SqliteStore, import_from_msgpack};
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let memory = Arc::new(SqliteStore::new("memory.db").await.unwrap());
    let count = import_from_msgpack(&*memory, "backup.msgpack").await.unwrap();
    println!("Imported {} entries", count);
}