pub struct RequestIdGenNumeric { /* private fields */ }Implementations§
Trait Implementations§
Source§impl RequestIdGen for RequestIdGenNumeric
impl RequestIdGen for RequestIdGenNumeric
Source§fn next_request_id(&self) -> RequestId
fn next_request_id(&self) -> RequestId
Generates the next unique request ID as an integer.
Increments the internal counter atomically and updates the last generated ID.
Uses Relaxed ordering for performance, as the counter only needs to ensure unique IDs.
Source§fn last_request_id(&self) -> Option<RequestId>
fn last_request_id(&self) -> Option<RequestId>
Returns the last generated request ID, if any.
Returns None if no ID has been generated (indicated by a sentinel value of -1).
Uses Relaxed ordering since the read operation doesn’t require synchronization
with other memory operations beyond atomicity.
Source§fn reset_to(&self, id: u64)
fn reset_to(&self, id: u64)
Resets the internal counter to the specified ID.
The provided id (u64) is converted to i64 and stored atomically.
Source§fn request_id_for_message(
&self,
message: &dyn McpMessage,
request_id: Option<RequestId>,
) -> Option<RequestId>
fn request_id_for_message( &self, message: &dyn McpMessage, request_id: Option<RequestId>, ) -> Option<RequestId>
Determines the request ID for an outgoing MCP message. Read more
Auto Trait Implementations§
impl !Freeze for RequestIdGenNumeric
impl RefUnwindSafe for RequestIdGenNumeric
impl Send for RequestIdGenNumeric
impl Sync for RequestIdGenNumeric
impl Unpin for RequestIdGenNumeric
impl UnwindSafe for RequestIdGenNumeric
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