pub struct EphemeralValue<T> { /* private fields */ }Expand description
A channel that is cleared after each superstep.
Ephemeral channels are useful for temporary data that should only be visible to nodes within a single superstep. After the step completes, the value is automatically cleared.
§Example
use rust_langgraph::channels::{BaseChannel, EphemeralValue};
let mut channel = EphemeralValue::<String>::new();
channel.update(vec![serde_json::json!("temporary")]).unwrap();
assert!(channel.get().unwrap().is_some());
// After superstep (simulated by calling clear)
channel.clear();
assert!(channel.get().unwrap().is_none());Implementations§
Trait Implementations§
Source§impl<T> BaseChannel for EphemeralValue<T>
impl<T> BaseChannel for EphemeralValue<T>
Source§fn update(&mut self, values: Vec<Value>) -> Result<()>
fn update(&mut self, values: Vec<Value>) -> Result<()>
Update the channel with new values Read more
Source§fn checkpoint(&self) -> Result<Value>
fn checkpoint(&self) -> Result<Value>
Serialize the channel state for checkpointing
Source§fn from_checkpoint(_data: Value) -> Result<Box<dyn BaseChannel>>
fn from_checkpoint(_data: Value) -> Result<Box<dyn BaseChannel>>
Restore the channel state from a checkpoint
Source§impl<T: Clone> Clone for EphemeralValue<T>
impl<T: Clone> Clone for EphemeralValue<T>
Source§fn clone(&self) -> EphemeralValue<T>
fn clone(&self) -> EphemeralValue<T>
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<T: Debug> Debug for EphemeralValue<T>
impl<T: Debug> Debug for EphemeralValue<T>
Auto Trait Implementations§
impl<T> Freeze for EphemeralValue<T>where
T: Freeze,
impl<T> RefUnwindSafe for EphemeralValue<T>where
T: RefUnwindSafe,
impl<T> Send for EphemeralValue<T>where
T: Send,
impl<T> Sync for EphemeralValue<T>where
T: Sync,
impl<T> Unpin for EphemeralValue<T>where
T: Unpin,
impl<T> UnsafeUnpin for EphemeralValue<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for EphemeralValue<T>where
T: UnwindSafe,
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