pub struct MemorySaver { /* private fields */ }Expand description
In-memory checkpoint storage.
Stores checkpoints in a HashMap in memory. Fast and simple, but does not persist across process restarts.
§Example
use rust_langgraph::checkpoint_backends::memory::MemorySaver;
use rust_langgraph::checkpoint::BaseCheckpointSaver;
use rust_langgraph::Config;
#[tokio::main]
async fn main() {
let saver = MemorySaver::new();
let config = Config::new().with_thread_id("test-123");
// Use saver with graph...
}Implementations§
Trait Implementations§
Source§impl BaseCheckpointSaver for MemorySaver
impl BaseCheckpointSaver for MemorySaver
Source§fn get_tuple<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointTuple>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_tuple<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointTuple>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a checkpoint tuple for the given configuration. Read more
Source§fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
checkpoint: &'life1 Checkpoint,
metadata: &'life2 CheckpointMetadata,
config: &'life3 Config,
) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
checkpoint: &'life1 Checkpoint,
metadata: &'life2 CheckpointMetadata,
config: &'life3 Config,
) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Save a checkpoint. Read more
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<CheckpointTuple>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<CheckpointTuple>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List checkpoints for a given configuration. Read more
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a specific checkpoint by ID
Source§impl Clone for MemorySaver
impl Clone for MemorySaver
Source§fn clone(&self) -> MemorySaver
fn clone(&self) -> MemorySaver
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemorySaver
impl Debug for MemorySaver
Auto Trait Implementations§
impl Freeze for MemorySaver
impl !RefUnwindSafe for MemorySaver
impl Send for MemorySaver
impl Sync for MemorySaver
impl Unpin for MemorySaver
impl UnsafeUnpin for MemorySaver
impl !UnwindSafe for MemorySaver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more