pub trait ReadonlyContext: Send + Sync {
Show 13 methods
// Required methods
fn invocation_id(&self) -> &str;
fn agent_name(&self) -> &str;
fn user_id(&self) -> &str;
fn app_name(&self) -> &str;
fn session_id(&self) -> &str;
fn branch(&self) -> &str;
fn user_content(&self) -> &Content;
// Provided methods
fn try_app_name(&self) -> Result<AppName> { ... }
fn try_user_id(&self) -> Result<UserId> { ... }
fn try_session_id(&self) -> Result<SessionId> { ... }
fn try_invocation_id(&self) -> Result<InvocationId> { ... }
fn try_identity(&self) -> Result<AdkIdentity> { ... }
fn try_execution_identity(&self) -> Result<ExecutionIdentity> { ... }
}Expand description
Read-only access to invocation metadata.
Provides identity information (user, app, session, invocation) and the current user content. Implemented by all context types.
Required Methods§
Sourcefn invocation_id(&self) -> &str
fn invocation_id(&self) -> &str
Returns the current invocation identifier.
Sourcefn agent_name(&self) -> &str
fn agent_name(&self) -> &str
Returns the name of the currently executing agent.
Sourcefn session_id(&self) -> &str
fn session_id(&self) -> &str
Returns the session identifier.
Sourcefn user_content(&self) -> &Content
fn user_content(&self) -> &Content
Returns the user’s input content for this invocation.
Provided Methods§
Sourcefn try_app_name(&self) -> Result<AppName>
fn try_app_name(&self) -> Result<AppName>
Returns the application name as a typed AppName.
Parses the value returned by app_name(). Returns an
error if the raw string fails validation (empty, null bytes, or exceeds
the maximum length).
§Errors
Returns an error when the underlying string is not a valid identifier.
Sourcefn try_user_id(&self) -> Result<UserId>
fn try_user_id(&self) -> Result<UserId>
Sourcefn try_session_id(&self) -> Result<SessionId>
fn try_session_id(&self) -> Result<SessionId>
Returns the session identifier as a typed SessionId.
Parses the value returned by session_id().
Returns an error if the raw string fails validation.
§Errors
Returns an error when the underlying string is not a valid identifier.
Sourcefn try_invocation_id(&self) -> Result<InvocationId>
fn try_invocation_id(&self) -> Result<InvocationId>
Returns the invocation identifier as a typed InvocationId.
Parses the value returned by invocation_id().
Returns an error if the raw string fails validation.
§Errors
Returns an error when the underlying string is not a valid identifier.
Sourcefn try_identity(&self) -> Result<AdkIdentity>
fn try_identity(&self) -> Result<AdkIdentity>
Returns the stable session-scoped AdkIdentity triple.
Combines try_app_name(),
try_user_id(), and
try_session_id() into a single composite
identity value.
§Errors
Returns an error if any of the three constituent identifiers fail validation.
Sourcefn try_execution_identity(&self) -> Result<ExecutionIdentity>
fn try_execution_identity(&self) -> Result<ExecutionIdentity>
Returns the full per-invocation ExecutionIdentity.
Combines try_identity() with the invocation,
branch, and agent name from this context.
§Errors
Returns an error if any of the four typed identifiers fail validation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".