pub struct State<S, R> {
pub conversations: HashMap<String, Conversation<S>>,
pub by_thread: HashMap<String, String>,
pub pending: HashMap<u64, Pending<R>>,
pub tools: HashMap<ToolToken, PendingTool>,
pub rpc_ids: HashSet<String>,
pub next_id: u64,
pub next_turn: u64,
}Fields§
§conversations: HashMap<String, Conversation<S>>§by_thread: HashMap<String, String>§pending: HashMap<u64, Pending<R>>§tools: HashMap<ToolToken, PendingTool>§rpc_ids: HashSet<String>§next_id: u64§next_turn: u64Implementations§
Source§impl<S, R> State<S, R>
impl<S, R> State<S, R>
pub fn allocate_request_id(&mut self) -> Result<u64, Error>
pub fn allocate_turn_id(&mut self) -> Result<u64, Error>
pub fn begin_turn( &mut self, key: impl Into<String>, sink: S, ) -> Result<u64, Error>
pub fn take_active(&mut self, key: &str, serial: u64) -> Option<Active<S>>
pub fn set_native_turn( &mut self, key: &str, serial: u64, turn: impl Into<String>, ) -> Option<Vec<Value>>
pub fn interrupt_target( &mut self, key: &str, serial: u64, ) -> Option<(String, String)>
pub fn take_sinks(&mut self) -> Vec<S>
pub fn thread(&self, key: &str) -> Option<&str>
pub fn owner(&self, thread: &str) -> Option<&str>
pub fn set_thread( &mut self, key: &str, thread: impl Into<String>, ) -> Result<(), Error>
pub fn begin_close(&mut self, key: &str) -> Result<Option<String>, Error>
pub fn cancel_close(&mut self, key: &str)
pub fn finish_close(&mut self, key: &str, thread: &str) -> Result<(), Error>
pub fn insert_pending( &mut self, id: u64, pending: Pending<R>, ) -> Result<(), Error>
pub fn take_pending(&mut self, id: u64) -> Result<Pending<R>, Error>
pub fn track_tool( &mut self, key: &str, serial: u64, call: impl Into<String>, id: &Value, ) -> Result<ToolToken, Error>
pub fn take_tool(&mut self, token: &ToolToken) -> Option<PendingTool>
pub fn take_turn_tools( &mut self, key: &str, serial: u64, ) -> Vec<(ToolToken, PendingTool)>
pub fn resolve_tool(&mut self, id: &Value) -> Result<Option<ToolToken>, Error>
Trait Implementations§
Auto Trait Implementations§
impl<S, R> Freeze for State<S, R>
impl<S, R> RefUnwindSafe for State<S, R>
impl<S, R> Send for State<S, R>
impl<S, R> Sync for State<S, R>
impl<S, R> Unpin for State<S, R>
impl<S, R> UnsafeUnpin for State<S, R>
impl<S, R> UnwindSafe for State<S, R>
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