pub struct ContextId(/* private fields */);Implementations§
Source§impl ContextId
impl ContextId
pub fn generate() -> Self
Sourcepub fn derived_from_gateway_conversation(gw: &GatewayConversationId) -> Self
pub fn derived_from_gateway_conversation(gw: &GatewayConversationId) -> Self
Mint a deterministic ContextId from a GatewayConversationId.
Same gateway-conversation id always produces the same ContextId, so
the gateway boundary can satisfy the “every conversation has a UUID
ContextId” data-integrity invariant without trusting the upstream
LLM client’s x-context-id header (which carries client-specific
non-UUID identifiers).
Sourcepub fn derived_from_messaging(platform: &str, org: &str, channel: &str) -> Self
pub fn derived_from_messaging(platform: &str, org: &str, channel: &str) -> Self
Mint a deterministic ContextId for a chat-platform conversation.
The same (platform, org, channel) triple — e.g.
("slack", workspace_id, channel_id) or
("teams", tenant_id, conversation_id) — always produces the same
ContextId, so the messaging dispatch boundary satisfies the “every
conversation has a UUID ContextId” invariant without a channel→context
mapping table.
Sourcepub fn derived_from_session(session_id: &SessionId) -> Self
pub fn derived_from_session(session_id: &SessionId) -> Self
Mint a deterministic ContextId from a SessionId.
Same session always produces the same ContextId, so session-scoped
boundaries with no conversation of their own (anonymous sessions,
hook-triggered inference such as session summaries, header fallbacks)
satisfy the “every AI request belongs to exactly one real context”
invariant without a session→context mapping table.
Sourcepub fn derived_from_evaluation_run(run_id: &EvalRunId) -> Self
pub fn derived_from_evaluation_run(run_id: &EvalRunId) -> Self
Mint a deterministic ContextId from an evaluation run id.
Same run always produces the same ContextId, so every judge and
replay request of one evaluation run lands in one context.
Sourcepub fn derived_from_cli_probe(server_name: &str) -> Self
pub fn derived_from_cli_probe(server_name: &str) -> Self
Mint a deterministic ContextId for a CLI probe of an MCP server.
Same server name always produces the same ContextId, so repeated
diagnostic probes of one server share one context.
Sourcepub fn derived_from_mcp_validation(service_name: &str) -> Self
pub fn derived_from_mcp_validation(service_name: &str) -> Self
Mint a deterministic ContextId for MCP service validation.
Same service name always produces the same ContextId, so repeated
validation passes of one service share one context.
Sourcepub fn derived_from_task(task_id: &TaskId) -> Self
pub fn derived_from_task(task_id: &TaskId) -> Self
Mint a deterministic ContextId from a TaskId.
Fallback for task-scoped boundaries when the task’s real context row
cannot be resolved; same task always produces the same ContextId.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ContextId
impl<'de> Deserialize<'de> for ContextId
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>,
Source§impl<'q, DB: Database> Encode<'q, DB> for ContextId
impl<'q, DB: Database> Encode<'q, DB> for ContextId
impl Eq for ContextId
Source§impl JsonSchema for ContextId
impl JsonSchema for ContextId
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§impl Ord for ContextId
impl Ord for ContextId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ContextId
impl PartialOrd for ContextId
Source§impl PgHasArrayType for ContextIdwhere
String: PgHasArrayType,
impl PgHasArrayType for ContextIdwhere
String: PgHasArrayType,
fn array_type_info() -> PgTypeInfo
fn array_compatible(ty: &PgTypeInfo) -> bool
impl StructuralPartialEq for ContextId
Source§impl ToDbValue for ContextId
impl ToDbValue for ContextId
fn to_db_value(&self) -> DbValue
fn null_db_value() -> DbValuewhere
Self: Sized,
Source§impl ToDbValue for &ContextId
impl ToDbValue for &ContextId
fn to_db_value(&self) -> DbValue
fn null_db_value() -> DbValuewhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for ContextId
impl RefUnwindSafe for ContextId
impl Send for ContextId
impl Sync for ContextId
impl Unpin for ContextId
impl UnsafeUnpin for ContextId
impl UnwindSafe for ContextId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more