pub struct IdempotencyKey(/* private fields */);Available on crate feature
unstable_protocol_v2 only.Expand description
A key the Client generates to identify one session/prompt submission across attempts.
The key is an opaque, case-sensitive string of 1 to 255 characters. It is scoped to the
session named by the request’s sessionId.
See protocol docs: Retrying a prompt
Implementations§
Source§impl IdempotencyKey
impl IdempotencyKey
Sourcepub const MAX_LENGTH: usize = 255
pub const MAX_LENGTH: usize = 255
The maximum length of a key, in characters.
Sourcepub fn new(key: impl Into<Arc<str>>) -> Result<Self, InvalidIdempotencyKey>
pub fn new(key: impl Into<Arc<str>>) -> Result<Self, InvalidIdempotencyKey>
Wraps a string as a typed IdempotencyKey.
§Errors
Returns InvalidIdempotencyKey if the key is empty or longer than
Self::MAX_LENGTH characters.
Trait Implementations§
Source§impl AsRef<str> for IdempotencyKey
impl AsRef<str> for IdempotencyKey
Source§impl Clone for IdempotencyKey
impl Clone for IdempotencyKey
Source§impl Debug for IdempotencyKey
impl Debug for IdempotencyKey
Source§impl<'de> Deserialize<'de> for IdempotencyKey
impl<'de> Deserialize<'de> for IdempotencyKey
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for IdempotencyKey
impl Display for IdempotencyKey
impl Eq for IdempotencyKey
Source§impl From<Uuid> for IdempotencyKey
Available on crate feature uuid only.
impl From<Uuid> for IdempotencyKey
Available on crate feature
uuid only.Source§impl FromStr for IdempotencyKey
impl FromStr for IdempotencyKey
Source§impl Hash for IdempotencyKey
impl Hash for IdempotencyKey
Source§impl JsonSchema for IdempotencyKey
Available on crate feature schemars only.
impl JsonSchema for IdempotencyKey
Available on crate feature
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for IdempotencyKey
impl PartialEq for IdempotencyKey
Source§impl Serialize for IdempotencyKey
impl Serialize for IdempotencyKey
impl StructuralPartialEq for IdempotencyKey
Source§impl TryFrom<&str> for IdempotencyKey
impl TryFrom<&str> for IdempotencyKey
Auto Trait Implementations§
impl Forget for IdempotencyKey
impl Freeze for IdempotencyKey
impl Move for IdempotencyKey
impl RefUnwindSafe for IdempotencyKey
impl Send for IdempotencyKey
impl Sync for IdempotencyKey
impl Unpin for IdempotencyKey
impl UnsafeUnpin for IdempotencyKey
impl UnwindSafe for IdempotencyKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.Source§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.