pub struct MessagesState {
pub messages: Vec<Message>,
}Expand description
State that contains a list of messages.
This is the standard state type for chat applications and agent workflows.
The add_messages function provides the reducer logic.
§Example
use rust_langgraph::{State, MessagesState, Message};
let mut state = MessagesState {
messages: vec![Message::user("Hello!")],
};
let update = MessagesState {
messages: vec![Message::assistant("Hi there!")],
};
state.merge(update).unwrap();
assert_eq!(state.messages.len(), 2);Fields§
§messages: Vec<Message>The list of messages
Trait Implementations§
Source§impl Clone for MessagesState
impl Clone for MessagesState
Source§fn clone(&self) -> MessagesState
fn clone(&self) -> MessagesState
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 MessagesState
impl Debug for MessagesState
Source§impl<'de> Deserialize<'de> for MessagesState
impl<'de> Deserialize<'de> for MessagesState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for MessagesState
impl Serialize for MessagesState
Source§impl State for MessagesState
impl State for MessagesState
Auto Trait Implementations§
impl Freeze for MessagesState
impl RefUnwindSafe for MessagesState
impl Send for MessagesState
impl Sync for MessagesState
impl Unpin for MessagesState
impl UnsafeUnpin for MessagesState
impl UnwindSafe for MessagesState
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