Skip to main content

QueryPersister

Trait QueryPersister 

Source
pub trait QueryPersister: Send + Sync {
    // Required methods
    fn load(&self) -> Vec<DehydratedEntry>;
    fn save(&self, entries: Vec<DehydratedEntry>);
}
Available on crate feature client only.
Expand description

Legacy synchronous persistence adapter trait for query cache persistence across app restarts.

Note: this is the shipped metadata-only skeleton. The richer async, value-carrying surface lives in [crate::client::persist] (the Persister trait + persist_with). This trait is retained for the existing dehydrate/hydrate/persist/restore methods and is feature-gated behind persist.

Implementations can store cached data in any backend (filesystem, database, etc.). Entries are serialized as JSON strings to avoid generic bounds on the persister.

§Example

use std::path::PathBuf;
use gpui_query::client::{QueryPersister, DehydratedEntry};

struct FilePersister { path: PathBuf }

impl QueryPersister for FilePersister {
    fn load(&self) -> Vec<DehydratedEntry> { Vec::new() }
    fn save(&self, _entries: Vec<DehydratedEntry>) {}
}

Required Methods§

Source

fn load(&self) -> Vec<DehydratedEntry>

Load persisted entries from storage.

Source

fn save(&self, entries: Vec<DehydratedEntry>)

Save entries to storage, replacing any previously stored data.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§