pub struct DcpContext { /* private fields */ }Expand description
Memory-mapped context for zero-copy sharing
Implementations§
Source§impl DcpContext
impl DcpContext
Create a context from existing shared memory
Sourcepub fn conversation_id(&self) -> u64
pub fn conversation_id(&self) -> u64
Get the conversation ID
Sourcepub fn message_count(&self) -> u64
pub fn message_count(&self) -> u64
Get the message count (atomic read)
Sourcepub fn increment_message_count(&self) -> u64
pub fn increment_message_count(&self) -> u64
Increment the message count atomically
Sourcepub fn get_tool_state(&self, index: usize) -> Option<&ToolState>
pub fn get_tool_state(&self, index: usize) -> Option<&ToolState>
Zero-copy access to tool state by index
Sourcepub fn find_tool_state(&self, tool_id: u32) -> Option<&ToolState>
pub fn find_tool_state(&self, tool_id: u32) -> Option<&ToolState>
Find tool state by tool_id
Sourcepub fn update_tool_state(
&mut self,
index: usize,
state: &ToolState,
) -> Result<(), DCPError>
pub fn update_tool_state( &mut self, index: usize, state: &ToolState, ) -> Result<(), DCPError>
Atomic update with memory fence
§Safety
This function uses unsafe pointer operations but ensures memory safety through proper bounds checking and memory fencing.
Sourcepub fn set_tool_state(&mut self, state: &ToolState) -> Result<usize, DCPError>
pub fn set_tool_state(&mut self, state: &ToolState) -> Result<usize, DCPError>
Update tool state by tool_id, finding or allocating a slot
Auto Trait Implementations§
impl Freeze for DcpContext
impl RefUnwindSafe for DcpContext
impl Send for DcpContext
impl Sync for DcpContext
impl Unpin for DcpContext
impl UnsafeUnpin for DcpContext
impl UnwindSafe for DcpContext
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