pub struct IdempotencyKey(/* private fields */);Expand description
Provider idempotency token for safe retries.
Validated on construction, empty, NUL, CR/LF, non-tab control
characters, and values longer than 1 KiB are rejected. Adapters
that advertise crate::Capabilities::idempotency_key forward the value
verbatim to the provider’s idempotency header; the validation closes
a header-injection seam at the type level.
new_unchecked is available on this type, it is declared via
the @unchecked matcher arm of crate::string_newtype! so
trusted-input construction (internal constants, test fixtures)
stays available. End-user code should reach for
Self::new / std::str::FromStr for any value that
originated outside trusted code paths.
Implementations§
Source§impl IdempotencyKey
impl IdempotencyKey
Sourcepub fn new(
value: impl Into<String>,
) -> Result<IdempotencyKey, StringNewtypeError>
pub fn new( value: impl Into<String>, ) -> Result<IdempotencyKey, StringNewtypeError>
Construct after validating the input.
§Errors
Returns $crate::StringNewtypeError if the value is
empty, exceeds STRING_NEWTYPE_MAX_BYTES, or contains
NUL, CR/LF, or non-tab control characters.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consume the newtype and return its string value.
Source§impl IdempotencyKey
impl IdempotencyKey
Sourcepub fn new_unchecked(value: impl Into<String>) -> IdempotencyKey
pub fn new_unchecked(value: impl Into<String>) -> IdempotencyKey
Construct without validating.
Reserved for trusted inputs (e.g. internal constants in
trusted code paths). Prefer Self::new or
std::str::FromStr for any value that originated
outside your own code.
This constructor exists only because the type was
declared via the @unchecked matcher arm of
crate::string_newtype!; the default arm omits it.
Trait Implementations§
Source§impl AsRef<str> for IdempotencyKey
impl AsRef<str> for IdempotencyKey
Source§impl Clone for IdempotencyKey
impl Clone for IdempotencyKey
Source§fn clone(&self) -> IdempotencyKey
fn clone(&self) -> IdempotencyKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§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<IdempotencyKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<IdempotencyKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for IdempotencyKey
impl Display for IdempotencyKey
impl Eq for IdempotencyKey
Source§impl FromStr for IdempotencyKey
impl FromStr for IdempotencyKey
Source§type Err = StringNewtypeError
type Err = StringNewtypeError
Source§fn from_str(s: &str) -> Result<IdempotencyKey, <IdempotencyKey as FromStr>::Err>
fn from_str(s: &str) -> Result<IdempotencyKey, <IdempotencyKey as FromStr>::Err>
s to return a value of this type. Read moreSource§impl Hash for IdempotencyKey
impl Hash for IdempotencyKey
Source§impl JsonSchema for IdempotencyKey
impl JsonSchema for IdempotencyKey
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 PartialEq for IdempotencyKey
impl PartialEq for IdempotencyKey
Source§impl Serialize for IdempotencyKey
impl Serialize for IdempotencyKey
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for IdempotencyKey
Source§impl TryFrom<&str> for IdempotencyKey
impl TryFrom<&str> for IdempotencyKey
Source§type Error = StringNewtypeError
type Error = StringNewtypeError
Source§fn try_from(
value: &str,
) -> Result<IdempotencyKey, <IdempotencyKey as TryFrom<&str>>::Error>
fn try_from( value: &str, ) -> Result<IdempotencyKey, <IdempotencyKey as TryFrom<&str>>::Error>
Source§impl TryFrom<String> for IdempotencyKey
impl TryFrom<String> for IdempotencyKey
Source§type Error = StringNewtypeError
type Error = StringNewtypeError
Source§fn try_from(
value: String,
) -> Result<IdempotencyKey, <IdempotencyKey as TryFrom<String>>::Error>
fn try_from( value: String, ) -> Result<IdempotencyKey, <IdempotencyKey as TryFrom<String>>::Error>
Auto Trait Implementations§
impl Freeze 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
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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreimpl<T> MaybeSend for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> RuntimeBound for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<T> ToEcoString for T
impl<T> ToEcoString for T
Source§fn to_eco_string(&self) -> EcoString
fn to_eco_string(&self) -> EcoString
EcoString.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.