pub struct LastValue<T> { /* private fields */ }Expand description
A channel that stores the last written value.
When multiple values are written in a single step, only the last one is kept. This is the most common channel type.
§Example
use rust_langgraph::channels::{BaseChannel, LastValue};
let mut channel = LastValue::<i32>::new();
channel.update(vec![serde_json::json!(1), serde_json::json!(2)]).unwrap();
assert_eq!(channel.get().unwrap(), Some(serde_json::json!(2)));Implementations§
Trait Implementations§
Source§impl<T> BaseChannel for LastValue<T>
impl<T> BaseChannel for LastValue<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
Auto Trait Implementations§
impl<T> Freeze for LastValue<T>where
T: Freeze,
impl<T> RefUnwindSafe for LastValue<T>where
T: RefUnwindSafe,
impl<T> Send for LastValue<T>where
T: Send,
impl<T> Sync for LastValue<T>where
T: Sync,
impl<T> Unpin for LastValue<T>where
T: Unpin,
impl<T> UnsafeUnpin for LastValue<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for LastValue<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