Public declaration syntax from forge-rs/crates/forge-collab/src/context.rs Original source SHA-256: c415243c7aacfc161a79a3fa7e5460d3ed332dd0f29078f67464f4eb23f05229 Function bodies and constant values are omitted. This is not the complete implementation. Source line 62 #[async_trait::async_trait] pub trait SharedContextContract: Send + Sync { /// Reads a context entry by key from the specified session. /// /// # Arguments /// /// * `session_id` - The session whose context to read from. /// * `key` - The key of the entry to read. /// /// # Returns /// /// The [`ContextEntry`] for the given key. /// /// # Errors /// /// Returns [`CollabError::ContextKeyNotFound`] if the key does not /// exist in the session's context. /// /// Returns [`CollabError::SessionNotFound`] if the session does not /// exist. // ANVIL Spec section 11.4 -- Shared Context: context_read async fn context_read(&self, session_id: &str, key: &str) -> Result; /// Writes a context entry to the specified session. /// /// If the key already exists, the entry is updated with the new value /// and its version is incremented. /// /// # Arguments /// /// * `session_id` - The session whose context to write to. /// * `entry` - The context entry to write. /// /// # Errors /// /// Returns [`CollabError::SessionNotFound`] if the session does not /// exist. // ANVIL Spec section 11.4 -- Shared Context: context_write async fn context_write(&self, session_id: &str, entry: ContextEntry) -> Result<(), CollabError>; /// Lists all keys in the specified session's context. /// /// # Arguments /// /// * `session_id` - The session whose context keys to list. /// /// # Returns /// /// A `Vec` of key strings. /// /// # Errors /// /// Returns [`CollabError::SessionNotFound`] if the session does not /// exist. // ANVIL Spec section 11.4 -- Shared Context: context_keys async fn context_keys(&self, session_id: &str) -> Result, CollabError>; } Source line 153 #[derive(Debug, Clone)] pub struct InMemorySharedContext { } Source line 167 pub fn new() -> Self; Source line 181 pub fn create_session(&mut self, session_id: &str); Source line 186 pub fn session_count(&self) -> usize; Source line 269 pub fn write_entry( &mut self, session_id: &str, entry: ContextEntry, ) -> Result<(), CollabError>; Source line 296 pub fn read_entry(&self, session_id: &str, key: &str) -> Result; Source line 321 pub fn list_keys(&self, session_id: &str) -> Result, CollabError>;