id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:16 | /// Returns true if the error is an IO error
pub fn is_io(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Io)
}
/// Returns true if the error is an timeout error
pub fn is_timeout(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Timeout)
}
/// Returns true if t... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8657f207e05add10eb5b9d0faaa17522e42a3f84 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8657f207e05add10eb5b9d0faaa17522e42a3f84/sdk/aws-smithy-http/src/result.rs | 601 | 636 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#![warn(
missing_debug_implementations,
missing_docs,
rustdoc::all,
unreachable_pub
)]
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use crate:... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | #[doc = concat!("Builder for [`", stringify!($errorName), "`](super::", stringify!($errorName), ").")]
#[derive(Debug, Default)]
pub struct $builderName {
source: Option<$sourceType>,
}
impl $builderName {
#[doc = "Creates a new builder."]... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | impl<R> Default for ResponseErrorBuilder<R> {
fn default() -> Self {
Self {
source: None,
raw: None,
}
}
}
impl<R> ResponseErrorBuilder<R> {
/// Creates a new builder.
pub fn new() -> Self {
Default::default()
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | /// Builds the error context.
pub fn build(self) -> ResponseError<R> {
ResponseError {
source: self.source.expect("source is required"),
raw: self.raw.expect("a raw response is required"),
}
}
}
/// Builder for [`ServiceError`](super::Serv... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | self
}
/// Sets the raw response.
pub fn raw(mut self, raw: R) -> Self {
self.raw = Some(raw);
self
}
/// Sets the raw response.
pub fn set_raw(&mut self, raw: Option<R>) -> &mut Self {
self.raw = raw;
self
}
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 161 | 220 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | pub struct TimeoutError {
source: BoxError,
}
impl TimeoutError {
/// Creates a builder for this error context type.
pub fn builder() -> builders::TimeoutErrorBuilder {
builders::TimeoutErrorBuilder::new()
}
}
/// Error context for [`SdkError::DispatchFailure`]
#[derive(Debug)]
pub struct Disp... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | self.source.is_other()
}
}
/// Error context for [`SdkError::ResponseError`]
#[derive(Debug)]
pub struct ResponseError<R> {
/// Error encountered while parsing the response
source: BoxError,
/// Raw response that was available
raw: R,
}
impl<R> ResponseError<R> {
/// Creates a builder for this... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | /// Creates a builder for this error context type.
pub fn builder() -> builders::ServiceErrorBuilder<E, R> {
builders::ServiceErrorBuilder::new()
}
/// Returns the underlying error of type `E`
pub fn err(&self) -> &E {
&self.source
}
/// Converts this error context into the und... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | /// [`DisplayErrorContext`](aws_smithy_types::error::display::DisplayErrorContext), use another
/// error reporter library that visits the error's cause/source chain, or call
/// [`Error::source`](std::error::Error::source) for more details about the underlying cause.
#[non_exhaustive]
#[derive(Debug)]
pub enum SdkErro... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 321 | 380 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:10 | pub fn dispatch_failure(source: ConnectorError) -> Self {
Self::DispatchFailure(DispatchFailure { source })
}
/// Construct a `SdkError` for a response error
pub fn response_error(source: impl Into<BoxError>, raw: R) -> Self {
Self::ResponseError(ResponseError {
source: source.i... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 361 | 420 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:11 | /// match sdk_err.into_service_error() {
/// GetObjectError::NoSuchKey(_) => {
/// // handle NoSuchKey
/// }
/// err @ _ => return Err(err),
/// }
/// # Ok(())
/// # }
/// ```
pub fn into_service_error(self) -> E
where
E: std::error::Error + Send + Syn... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 401 | 460 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:12 | match self {
SdkError::ConstructionFailure(_) => write!(f, "failed to construct request"),
SdkError::TimeoutError(_) => write!(f, "request has timed out"),
SdkError::DispatchFailure(_) => write!(f, "dispatch failure"),
SdkError::ResponseError(_) => write!(f, "response err... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 441 | 500 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:13 | }
#[derive(Debug)]
enum ConnectorErrorKind {
/// A timeout occurred while processing the request
Timeout,
/// A user-caused error (e.g., invalid HTTP request)
User,
/// Socket/IO error
Io,
/// An unclassified Error with an explicit error kind
Other(Option<ErrorKind>),
}
/// Error fr... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 481 | 540 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:14 | impl Error for ConnectorError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(self.source.as_ref())
}
}
impl ConnectorError {
/// Construct a [`ConnectorError`] from an error caused by a timeout
///
/// Timeout errors are typically retried on a new connection.
pub fn timeout... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 521 | 580 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:15 | }
}
/// Returns true if the error is an IO error
pub fn is_io(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Io)
}
/// Returns true if the error is an timeout error
pub fn is_timeout(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Timeout)
}
/// Retu... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ca699a1ae9b4f4f3a2cba41c5ddc54a10e2c86a6/sdk/aws-smithy-http/src/result.rs | 561 | 586 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#![warn(
missing_debug_implementations,
missing_docs,
rustdoc::all,
unreachable_pub
)]
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use crate:... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | /// Error context for [`SdkError::TimeoutError`]
#[derive(Debug)]
pub struct TimeoutError {
source: BoxError,
}
/// Error context for [`SdkError::DispatchFailure`]
#[derive(Debug)]
pub struct DispatchFailure {
source: ConnectorError,
}
impl DispatchFailure {
/// Returns true if the error is an IO error
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | raw: R,
}
impl<R> ResponseError<R> {
/// Returns a reference to the raw response
pub fn raw(&self) -> &R {
&self.raw
}
/// Converts this error context into the raw response
pub fn into_raw(self) -> R {
self.raw
}
}
/// Error context for [`SdkError::ServiceError`]
#[derive(Debu... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | /// Converts this error context into the raw response
pub fn into_raw(self) -> R {
self.raw
}
}
/// Constructs the unhandled variant of a code generated error.
///
/// This trait exists so that [`SdkError::into_service_error`] can be infallible.
pub trait CreateUnhandledError {
/// Creates an unhan... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | /// An error response was received from the service
ServiceError(ServiceError<E, R>),
}
impl<E, R> SdkError<E, R> {
/// Construct a `SdkError` for a construction failure
pub fn construction_failure(source: impl Into<BoxError>) -> Self {
Self::ConstructionFailure(ConstructionFailure {
so... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 161 | 220 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | /// then it will be converted into an unhandled variant of `E`. This makes it easy to match
/// on the service's error response while simultaneously bubbling up transient failures.
/// For example, handling the `NoSuchKey` error for S3's `GetObject` operation may look as
/// follows:
///
/// ```no_r... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | /// Converts this error into its error source.
///
/// If there is no error source, then `Err(Self)` is returned.
pub fn into_source(self) -> Result<Box<dyn Error + Send + Sync + 'static>, Self>
where
E: std::error::Error + Send + Sync + 'static,
{
use SdkError::*;
match self... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | ResponseError(context) => Some(context.source.as_ref()),
DispatchFailure(context) => Some(&context.source),
ServiceError(context) => Some(&context.source),
}
}
}
impl<E, R> ProvideErrorMetadata for SdkError<E, R>
where
E: ProvideErrorMetadata,
{
fn meta(&self) -> &aws_smithy... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | /// that comes off a potentially generic or dynamic connector.
/// The attached `kind` is used to determine what retry behavior should occur (if any) based on the
/// connector error.
#[derive(Debug)]
pub struct ConnectorError {
kind: ConnectorErrorKind,
source: BoxError,
}
impl Display for ConnectorError {
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 321 | 380 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:10 | kind: ConnectorErrorKind::User,
source,
}
}
/// Construct a [`ConnectorError`] from an IO related error (e.g. socket hangup)
pub fn io(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Io,
source,
}
}
/// Construct a [`Connecto... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | e7c474c6e317023a48b6e41f16efe3c7a2c3aba2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e7c474c6e317023a48b6e41f16efe3c7a2c3aba2/sdk/aws-smithy-http/src/result.rs | 361 | 406 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#![warn(
missing_debug_implementations,
missing_docs,
rustdoc::all,
unreachable_pub
)]
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use crate:... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | pub struct TimeoutError {
source: BoxError,
}
/// Error context for [`SdkError::DispatchFailure`]
#[derive(Debug)]
pub struct DispatchFailure {
source: ConnectorError,
}
impl DispatchFailure {
/// Returns true if the error is an IO error
pub fn is_io(&self) -> bool {
self.source.is_io()
}
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | impl<R> ResponseError<R> {
/// Returns a reference to the raw response
pub fn raw(&self) -> &R {
&self.raw
}
/// Converts this error context into the raw response
pub fn into_raw(self) -> R {
self.raw
}
}
/// Error context for [`SdkError::ServiceError`]
#[derive(Debug)]
pub str... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | self.raw
}
}
/// Constructs the unhandled variant of a code generated error.
///
/// This trait exists so that [`SdkError::into_service_error`] can be infallible.
pub trait CreateUnhandledError {
/// Creates an unhandled error variant with the given `source`.
fn create_unhandled_error(source: Box<dyn Error... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | /// Construct a `SdkError` for a construction failure
pub fn construction_failure(source: impl Into<BoxError>) -> Self {
Self::ConstructionFailure(ConstructionFailure {
source: source.into(),
})
}
/// Construct a `SdkError` for a timeout
pub fn timeout_error(source: impl Int... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 161 | 220 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | /// ```no_run
/// # use aws_smithy_http::result::{SdkError, CreateUnhandledError};
/// # #[derive(Debug)] enum GetObjectErrorKind { NoSuchKey(()), Other(()) }
/// # #[derive(Debug)] struct GetObjectError { kind: GetObjectErrorKind }
/// # impl std::fmt::Display for GetObjectError {
/// # fn fmt(... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | use SdkError::*;
match self {
ConstructionFailure(context) => Ok(context.source),
TimeoutError(context) => Ok(context.source),
ResponseError(context) => Ok(context.source),
DispatchFailure(context) => Ok(context.source.into()),
ServiceError(context) =>... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | #[derive(Debug)]
enum ConnectorErrorKind {
/// A timeout occurred while processing the request
Timeout,
/// A user-caused error (e.g., invalid HTTP request)
User,
/// Socket/IO error
Io,
/// An unclassified Error with an explicit error kind
Other(Option<ErrorKind>),
}
/// Error from ... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | Some(self.source.as_ref())
}
}
impl ConnectorError {
/// Construct a [`ConnectorError`] from an error caused by a timeout
///
/// Timeout errors are typically retried on a new connection.
pub fn timeout(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Timeout,
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 321 | 380 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:10 | /// Returns true if the error is an IO error
pub fn is_io(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Io)
}
/// Returns true if the error is an timeout error
pub fn is_timeout(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Timeout)
}
/// Returns true if t... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a6f6e7e4e7cdf8b15473b8d22a9c1b09ca0fcf6/sdk/aws-smithy-http/src/result.rs | 361 | 384 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | impl<R> ResponseError<R> {
/// Returns a reference to the raw response
pub fn raw(&self) -> &R {
&self.raw
}
/// Converts this error context into the raw response
pub fn into_raw(self) -> R {
self.raw
}
}
/// Error context for [`SdkError::ServiceError`]
#[derive(Debug)]
pub str... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | a7b495365b268e38270d510e23751b09ac7af84b | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a7b495365b268e38270d510e23751b09ac7af84b/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | self.raw
}
}
/// Constructs the unhandled variant of a code generated error.
///
/// This trait exists so that [`SdkError::into_service_error`] can be infallible.
pub trait CreateUnhandledError {
/// Creates an unhandled error variant with the given `source`.
fn create_unhandled_error(source: Box<dyn Error... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | a7b495365b268e38270d510e23751b09ac7af84b | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a7b495365b268e38270d510e23751b09ac7af84b/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | }
/// Construct a `SdkError` for a timeout
pub fn timeout_error(source: impl Into<BoxError>) -> Self {
Self::TimeoutError(TimeoutError {
source: source.into(),
})
}
/// Construct a `SdkError` for a dispatch failure with a [`ConnectorError`]
pub fn dispatch_failure(sourc... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | a7b495365b268e38270d510e23751b09ac7af84b | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a7b495365b268e38270d510e23751b09ac7af84b/sdk/aws-smithy-http/src/result.rs | 161 | 220 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | /// # fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { unimplemented!() }
/// # }
/// # impl std::error::Error for GetObjectError {}
/// # impl CreateUnhandledError for GetObjectError {
/// # fn create_unhandled_error(_: Box<dyn std::error::Error + Send + Sync + 'static>) -> ... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | a7b495365b268e38270d510e23751b09ac7af84b | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a7b495365b268e38270d510e23751b09ac7af84b/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | DispatchFailure(context) => Ok(context.source.into()),
ServiceError(context) => Ok(context.source.into()),
}
}
}
impl<E, R> Display for SdkError<E, R> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
SdkError::ConstructionFailure(_) => write!(f, "fail... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | a7b495365b268e38270d510e23751b09ac7af84b | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a7b495365b268e38270d510e23751b09ac7af84b/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | /// A user-caused error (e.g., invalid HTTP request)
User,
/// Socket/IO error
Io,
/// An unclassified Error with an explicit error kind
Other(Option<ErrorKind>),
}
/// Error from the underlying Connector
///
/// Connector exists to attach a `ConnectorErrorKind` to what would otherwise be an opaq... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | a7b495365b268e38270d510e23751b09ac7af84b | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a7b495365b268e38270d510e23751b09ac7af84b/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | /// Construct a [`ConnectorError`] from an error caused by a timeout
///
/// Timeout errors are typically retried on a new connection.
pub fn timeout(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Timeout,
source,
}
}
/// Construct a [`Connector... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | a7b495365b268e38270d510e23751b09ac7af84b | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a7b495365b268e38270d510e23751b09ac7af84b/sdk/aws-smithy-http/src/result.rs | 321 | 379 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:10 | /// Returns true if the error is an timeout error
pub fn is_timeout(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Timeout)
}
/// Returns true if the error is a user-caused error (e.g., invalid HTTP request)
pub fn is_user(&self) -> bool {
matches!(self.kind, ConnectorErrorKin... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | a7b495365b268e38270d510e23751b09ac7af84b | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a7b495365b268e38270d510e23751b09ac7af84b/sdk/aws-smithy-http/src/result.rs | 361 | 379 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | impl<R> ResponseError<R> {
/// Returns a reference to the raw response
pub fn raw(&self) -> &R {
&self.raw
}
/// Converts this error context into the raw response
pub fn into_raw(self) -> R {
self.raw
}
}
/// Error context for [`SdkError::ServiceError`]
#[derive(Debug)]
pub str... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | self.raw
}
}
/// Failed SDK Result
#[non_exhaustive]
#[derive(Debug)]
pub enum SdkError<E, R = operation::Response> {
/// The request failed during construction. It was not dispatched over the network.
ConstructionFailure(ConstructionFailure),
/// The request failed due to a timeout. The request MAY h... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | /// Construct a `SdkError` for a dispatch failure with a [`ConnectorError`]
pub fn dispatch_failure(source: ConnectorError) -> Self {
Self::DispatchFailure(DispatchFailure { source })
}
/// Construct a `SdkError` for a response error
pub fn response_error(source: impl Into<BoxError>, raw: R) ->... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/result.rs | 161 | 220 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:6 | /// err @ _ => return Err(err.into()),
/// }
/// # Ok(())
/// # }
/// ```
pub fn into_service_error(self) -> Result<E, Self> {
match self {
Self::ServiceError(context) => Ok(context.source),
_ => Err(self),
}
}
/// Converts this error into its err... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/result.rs | 201 | 260 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:7 | }
impl<E, R> Error for SdkError<E, R>
where
E: Error + 'static,
R: Debug,
{
fn source(&self) -> Option<&(dyn Error + 'static)> {
use SdkError::*;
match self {
ConstructionFailure(context) => Some(context.source.as_ref()),
TimeoutError(context) => Some(context.source.... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/result.rs | 241 | 300 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:8 | #[derive(Debug)]
pub struct ConnectorError {
kind: ConnectorErrorKind,
source: BoxError,
}
impl Display for ConnectorError {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self.kind {
ConnectorErrorKind::Timeout => write!(f, "timeout"),
ConnectorErrorKind::User ... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/result.rs | 281 | 340 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:9 | }
/// Construct a [`ConnectorError`] from an IO related error (e.g. socket hangup)
pub fn io(source: BoxError) -> Self {
Self {
kind: ConnectorErrorKind::Io,
source,
}
}
/// Construct a [`ConnectorError`] from an different unclassified error.
///
/// Opt... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/result.rs | 321 | 363 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#![warn(
missing_debug_implementations,
missing_docs,
rustdoc::all,
unreachable_pub
)]
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use crate:... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | /// The request failed during dispatch. An HTTP response was not received. The request MAY
/// have been sent.
DispatchFailure(ConnectorError),
/// A response was received but it was not parseable according the the protocol (for example
/// the server hung up while the body was being read)
Response... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/result.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | impl Error for ConnectorError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(self.err.as_ref())
}
}
impl ConnectorError {
/// Construct a [`ConnectorError`] from an error caused by a timeout
///
/// Timeout errors are typically retried on a new connection.
pub fn timeout(er... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | kind: ConnectorErrorKind::Other(kind),
}
}
/// Returns true if the error is an IO error
pub fn is_io(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Io)
}
/// Returns true if the error is an timeout error
pub fn is_timeout(&self) -> bool {
matches!(self.kind, C... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | Other(Option<ErrorKind>),
}
impl Display for ConnectorErrorKind {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
ConnectorErrorKind::Timeout => write!(f, "timeout"),
ConnectorErrorKind::User => write!(f, "user error"),
ConnectorErrorKind::Io => write!... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/result.rs | 161 | 206 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![warn(
missing_debug_implementations,
missing_docs,
rustdoc::all,
unreachable_pub
)]
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use crate... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | 5f4378d3e820cebbb6b7e7413d4592c7d5441559 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5f4378d3e820cebbb6b7e7413d4592c7d5441559/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![warn(
missing_debug_implementations,
missing_docs,
rustdoc::all,
unreachable_pub
)]
//! `Result` wrapper types for [success](SdkSuccess) and [failure](SdkError) responses.
use crate... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | bc807bc785a0d1772ce0c88cde8108b66116dd18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/bc807bc785a0d1772ce0c88cde8108b66116dd18/sdk/aws-smithy-http/src/result.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:2 | DispatchFailure(ConnectorError),
/// A response was received but it was not parseable according the the protocol (for example
/// the server hung up while the body was being read)
ResponseError {
/// Error encountered while parsing the response
err: BoxError,
/// Raw response that w... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | bc807bc785a0d1772ce0c88cde8108b66116dd18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/bc807bc785a0d1772ce0c88cde8108b66116dd18/sdk/aws-smithy-http/src/result.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:3 | Some(self.err.as_ref())
}
}
impl ConnectorError {
/// Construct a [`ConnectorError`] from an error caused by a timeout
///
/// Timeout errors are typically retried on a new connection.
pub fn timeout(err: BoxError) -> Self {
Self {
err,
kind: ConnectorErrorKind::Time... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | bc807bc785a0d1772ce0c88cde8108b66116dd18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/bc807bc785a0d1772ce0c88cde8108b66116dd18/sdk/aws-smithy-http/src/result.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:4 | /// Returns true if the error is an IO error
pub fn is_io(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Io)
}
/// Returns true if the error is an timeout error
pub fn is_timeout(&self) -> bool {
matches!(self.kind, ConnectorErrorKind::Timeout)
}
/// Returns true if t... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | bc807bc785a0d1772ce0c88cde8108b66116dd18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/bc807bc785a0d1772ce0c88cde8108b66116dd18/sdk/aws-smithy-http/src/result.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/result.rs:5 | impl Display for ConnectorErrorKind {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
ConnectorErrorKind::Timeout => write!(f, "timeout"),
ConnectorErrorKind::User => write!(f, "user error"),
ConnectorErrorKind::Io => write!(f, "io error"),
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/result.rs | Apache-2.0 | bc807bc785a0d1772ce0c88cde8108b66116dd18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/bc807bc785a0d1772ce0c88cde8108b66116dd18/sdk/aws-smithy-http/src/result.rs | 161 | 201 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! HTTP specific retry behaviors
//!
//! For protocol agnostic retries, see `aws_smithy_types::Retry`.
use crate::operation::Response;
use crate::result::SdkError;
use aws_smithy_types::retry::{ErrorKi... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | ce28848a2f73a8ba0c4b526135983ce8ef19255e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ce28848a2f73a8ba0c4b526135983ce8ef19255e/sdk/aws-smithy-http/src/retry.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:2 | match result {
Ok(_) => Err(RetryKind::Unnecessary),
Err(SdkError::ServiceError(context)) => Ok((context.err(), context.raw())),
Err(SdkError::TimeoutError(_err)) => Err(RetryKind::Error(ErrorKind::TransientError)),
Err(SdkError::DispatchFailure(err)) => {
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | ce28848a2f73a8ba0c4b526135983ce8ef19255e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ce28848a2f73a8ba0c4b526135983ce8ef19255e/sdk/aws-smithy-http/src/retry.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:3 | use super::*;
use crate::body::SdkBody;
use crate::operation;
use crate::result::{SdkError, SdkSuccess};
use crate::retry::ClassifyRetry;
use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind};
use std::fmt;
#[derive(Debug)]
struct UnmodeledError;
impl fmt::Display fo... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | ce28848a2f73a8ba0c4b526135983ce8ef19255e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ce28848a2f73a8ba0c4b526135983ce8ef19255e/sdk/aws-smithy-http/src/retry.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:4 | fn make_err<E>(
err: E,
raw: http::Response<&'static str>,
) -> Result<SdkSuccess<()>, SdkError<E>> {
Err(SdkError::service_error(
err,
operation::Response::new(raw.map(SdkBody::from)),
))
}
#[test]
fn not_an_error() {
let policy = Default... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | ce28848a2f73a8ba0c4b526135983ce8ef19255e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ce28848a2f73a8ba0c4b526135983ce8ef19255e/sdk/aws-smithy-http/src/retry.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:5 | .unwrap();
assert_eq!(
policy.classify_retry(make_err(UnmodeledError, test_resp).as_ref()),
RetryKind::UnretryableFailure
);
}
#[test]
fn classify_by_error_kind() {
struct ModeledRetries;
let test_response = http::Response::new("OK");
impl Pro... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | ce28848a2f73a8ba0c4b526135983ce8ef19255e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ce28848a2f73a8ba0c4b526135983ce8ef19255e/sdk/aws-smithy-http/src/retry.rs | 161 | 215 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:6 | ),
RetryKind::Error(ErrorKind::TransientError)
);
}
#[test]
fn test_timeout_error() {
let policy = DefaultResponseRetryClassifier::new();
let err: Result<(), SdkError<UnmodeledError>> = Err(SdkError::timeout_error("blah"));
assert_eq!(
policy.classify... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | ce28848a2f73a8ba0c4b526135983ce8ef19255e | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/ce28848a2f73a8ba0c4b526135983ce8ef19255e/sdk/aws-smithy-http/src/retry.rs | 201 | 215 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! HTTP specific retry behaviors
//!
//! For protocol agnostic retries, see `aws_smithy_types::Retry`.
use crate::operation::Response;
use crate::result::SdkError;
use aws_smithy_types::retry::{ErrorKi... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/retry.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:2 | match result {
Ok(_) => Err(RetryKind::Unnecessary),
Err(SdkError::ServiceError(context)) => Ok((context.err(), context.raw())),
Err(SdkError::TimeoutError(_err)) => Err(RetryKind::Error(ErrorKind::TransientError)),
Err(SdkError::DispatchFailure(err)) => {
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 2b4a7b881b8735aad288284e1c140ed40f474d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2b4a7b881b8735aad288284e1c140ed40f474d06/sdk/aws-smithy-http/src/retry.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! HTTP specific retry behaviors
//!
//! For protocol agnostic retries, see `aws_smithy_types::Retry`.
use crate::operation::Response;
use crate::result::SdkError;
use aws_smithy_types::retry::{ErrorKi... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/retry.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:2 | Ok(_) => Err(RetryKind::Unnecessary),
Err(SdkError::ServiceError(context)) => Ok((context.err(), context.raw())),
Err(SdkError::TimeoutError(_err)) => Err(RetryKind::Error(ErrorKind::TransientError)),
Err(SdkError::DispatchFailure(err)) => {
if err.is_timeout() || err... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/retry.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:3 | use crate::body::SdkBody;
use crate::operation;
use crate::result::{SdkError, SdkSuccess};
use crate::retry::ClassifyRetry;
use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind};
use std::fmt;
#[derive(Debug)]
struct UnmodeledError;
impl fmt::Display for UnmodeledError {... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/retry.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:4 | fn make_err<E>(
err: E,
raw: http::Response<&'static str>,
) -> Result<SdkSuccess<()>, SdkError<E>> {
Err(SdkError::service_error(
err,
operation::Response::new(raw.map(SdkBody::from)),
))
}
#[test]
fn not_an_error() {
let policy = Default... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/retry.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:5 | assert_eq!(
policy.classify_retry(make_err(UnmodeledError, test_resp).as_ref()),
RetryKind::UnretryableFailure
);
}
#[test]
fn classify_by_error_kind() {
struct ModeledRetries;
let test_response = http::Response::new("OK");
impl ProvideErrorKind for M... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/retry.rs | 161 | 214 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:6 | RetryKind::Error(ErrorKind::TransientError)
);
}
#[test]
fn test_timeout_error() {
let policy = DefaultResponseRetryClassifier::new();
let err: Result<(), SdkError<UnmodeledError>> = Err(SdkError::timeout_error("blah"));
assert_eq!(
policy.classify_retry(err.as_r... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 305c4aa0a153737d28f3c9cbbf425e5dcd946da1 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/305c4aa0a153737d28f3c9cbbf425e5dcd946da1/sdk/aws-smithy-http/src/retry.rs | 201 | 214 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! HTTP specific retry behaviors
//!
//! For protocol agnostic retries, see `aws_smithy_types::Retry`.
use crate::operation::Response;
use crate::result::SdkError;
use aws_smithy_types::retry::{ErrorKi... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 7a46124da32a066e7fb6a1d647e2f99cbbb026e0 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a46124da32a066e7fb6a1d647e2f99cbbb026e0/sdk/aws-smithy-http/src/retry.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:2 | Ok(_) => Err(RetryKind::Unnecessary),
Err(SdkError::ServiceError { err, raw }) => Ok((err, raw)),
Err(SdkError::TimeoutError(_err)) => Err(RetryKind::Error(ErrorKind::TransientError)),
Err(SdkError::DispatchFailure(err)) => {
if err.is_timeout() || err.is_io() {
... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 7a46124da32a066e7fb6a1d647e2f99cbbb026e0 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a46124da32a066e7fb6a1d647e2f99cbbb026e0/sdk/aws-smithy-http/src/retry.rs | 41 | 100 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:3 | use crate::body::SdkBody;
use crate::operation;
use crate::result::{SdkError, SdkSuccess};
use crate::retry::ClassifyRetry;
use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind};
use std::fmt;
#[derive(Debug)]
struct UnmodeledError;
impl fmt::Display for UnmodeledError {... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 7a46124da32a066e7fb6a1d647e2f99cbbb026e0 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a46124da32a066e7fb6a1d647e2f99cbbb026e0/sdk/aws-smithy-http/src/retry.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:4 | fn make_err<E>(
err: E,
raw: http::Response<&'static str>,
) -> Result<SdkSuccess<()>, SdkError<E>> {
Err(SdkError::ServiceError {
err,
raw: operation::Response::new(raw.map(SdkBody::from)),
})
}
#[test]
fn not_an_error() {
let policy = De... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 7a46124da32a066e7fb6a1d647e2f99cbbb026e0 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a46124da32a066e7fb6a1d647e2f99cbbb026e0/sdk/aws-smithy-http/src/retry.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:5 | assert_eq!(
policy.classify_retry(make_err(UnmodeledError, test_resp).as_ref()),
RetryKind::UnretryableFailure
);
}
#[test]
fn classify_by_error_kind() {
struct ModeledRetries;
let test_response = http::Response::new("OK");
impl ProvideErrorKind for M... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 7a46124da32a066e7fb6a1d647e2f99cbbb026e0 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a46124da32a066e7fb6a1d647e2f99cbbb026e0/sdk/aws-smithy-http/src/retry.rs | 161 | 214 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:6 | RetryKind::Error(ErrorKind::TransientError)
);
}
#[test]
fn test_timeout_error() {
let policy = DefaultResponseRetryClassifier::new();
let err: Result<(), SdkError<UnmodeledError>> = Err(SdkError::TimeoutError("blah".into()));
assert_eq!(
policy.classify_retry(er... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 7a46124da32a066e7fb6a1d647e2f99cbbb026e0 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/7a46124da32a066e7fb6a1d647e2f99cbbb026e0/sdk/aws-smithy-http/src/retry.rs | 201 | 214 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:3 | use crate::body::SdkBody;
use crate::operation;
use crate::result::{SdkError, SdkSuccess};
use crate::retry::ClassifyRetry;
use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind};
use std::fmt;
#[derive(Debug)]
struct UnmodeledError;
impl fmt::Display for UnmodeledError {... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | d9b0e139d03bb5cdd990998dda0cf2a79f151e99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/d9b0e139d03bb5cdd990998dda0cf2a79f151e99/sdk/aws-smithy-http/src/retry.rs | 81 | 140 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:4 | fn make_err<E>(
err: E,
raw: http::Response<&'static str>,
) -> Result<SdkSuccess<()>, SdkError<E>> {
Err(SdkError::ServiceError {
err,
raw: operation::Response::new(raw.map(|b| SdkBody::from(b))),
})
}
#[test]
fn not_an_error() {
let poli... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | d9b0e139d03bb5cdd990998dda0cf2a79f151e99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/d9b0e139d03bb5cdd990998dda0cf2a79f151e99/sdk/aws-smithy-http/src/retry.rs | 121 | 180 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:5 | assert_eq!(
policy.classify_retry(make_err(UnmodeledError, test_resp).as_ref()),
RetryKind::UnretryableFailure
);
}
#[test]
fn classify_by_error_kind() {
struct ModeledRetries;
let test_response = http::Response::new("OK");
impl ProvideErrorKind for M... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | d9b0e139d03bb5cdd990998dda0cf2a79f151e99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/d9b0e139d03bb5cdd990998dda0cf2a79f151e99/sdk/aws-smithy-http/src/retry.rs | 161 | 216 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:6 | .as_ref()
),
RetryKind::Error(ErrorKind::TransientError)
);
}
#[test]
fn test_timeout_error() {
let policy = DefaultResponseRetryClassifier::new();
let err: Result<(), SdkError<UnmodeledError>> = Err(SdkError::TimeoutError("blah".into()));
assert_eq!(... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | d9b0e139d03bb5cdd990998dda0cf2a79f151e99 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/d9b0e139d03bb5cdd990998dda0cf2a79f151e99/sdk/aws-smithy-http/src/retry.rs | 201 | 216 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//! HTTP specific retry behaviors
//!
//! For protocol agnostic retries, see `aws_smithy_types::Retry`.
use aws_smithy_types::retry::RetryKind;
pub trait ClassifyResponse<T, E>: Clone {
fn classify... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/retry.rs | 1 | 20 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/retry.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
//! HTTP specific retry behaviors
//!
//! For protocol agnostic retries, see `aws_smithy_types::Retry`.
use aws_smithy_types::retry::RetryKind;
pub trait ClassifyResponse<T, E>: Clone {
fn classif... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/retry.rs | Apache-2.0 | f886db64dcf9a331eb1be7e4809ba9ca792add23 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/f886db64dcf9a331eb1be7e4809ba9ca792add23/sdk/aws-smithy-http/src/retry.rs | 1 | 20 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/urlencode.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use percent_encoding::{AsciiSet, CONTROLS};
/// base set of characters that must be URL encoded
pub(crate) const BASE_SET: &AsciiSet = &CONTROLS
.add(b' ')
.add(b'/')
// RFC-3986 §3.3 allows... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/urlencode.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-http/src/urlencode.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/urlencode.rs:2 | .add(b'`')
.add(b'\\');
#[cfg(test)]
mod test {
use crate::urlencode::BASE_SET;
use percent_encoding::utf8_percent_encode;
#[test]
fn set_includes_mandatory_characters() {
let chars = ":/?#[]@!$&'()*+,;=%";
let escaped = utf8_percent_encode(chars, BASE_SET).to_string();
ass... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/urlencode.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-http/src/urlencode.rs | 41 | 61 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/urlencode.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use percent_encoding::{AsciiSet, CONTROLS};
/// base set of characters that must be URL encoded
pub const BASE_SET: &AsciiSet = &CONTROLS
.add(b' ')
.add(b'/')
// RFC-3986 §3.3 allows sub-de... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/urlencode.rs | Apache-2.0 | 8159cb8ff570e4dca718e354c31cecdfadfeb0b8 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8159cb8ff570e4dca718e354c31cecdfadfeb0b8/sdk/aws-smithy-http/src/urlencode.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-http/src/urlencode.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use percent_encoding::{AsciiSet, CONTROLS};
/// base set of characters that must be URL encoded
pub const BASE_SET: &AsciiSet = &CONTROLS
.add(b' ')
.add(b'/')
// RFC-3986 §3.3 allows sub-d... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-http/src/urlencode.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/sdk/aws-smithy-http/src/urlencode.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use aws_smithy_json::deserialize::{Error, Token};
use aws_smithy_types::Number;
use serde_json::{Map, Value};
use std::iter::Peekable;
pub fn run_data(data: &[u8]) {
// Parse through with aws-smithy... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs:2 | assert_eq!(None, token_iter.next());
assert_eq!(value, converted_value);
}
}
/// Converts a token stream into a Serde [Value]
fn convert_tokens<'a, I: Iterator<Item = Token<'a>>>(tokens: &mut Peekable<I>) -> Value {
match tokens.next().unwrap() {
Token::StartObject { .. } => {
let m... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs | 41 | 91 |
awslabs/aws-sdk-rust:sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs:3 | Token::ValueNull { .. } => Value::Null,
Token::ValueNumber { value, .. } => Value::Number(match value {
Number::NegInt(value) => serde_json::Number::from(value),
Number::PosInt(value) => serde_json::Number::from(value),
Number::Float(value) => serde_json::Number::from_f64(val... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs | 81 | 91 |
awslabs/aws-sdk-rust:sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_smithy_json::deserialize::{Error, Token};
use aws_smithy_types::Number;
use serde_json::{Map, Value};
use std::iter::Peekable;
pub fn run_data(data: &[u8]) {
// Parse through with aws-smith... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs | Apache-2.0 | bc807bc785a0d1772ce0c88cde8108b66116dd18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/bc807bc785a0d1772ce0c88cde8108b66116dd18/sdk/aws-smithy-json/fuzz/fuzz_targets/common.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-json/fuzz/fuzz_targets/json_deserialize.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#![no_main]
use libfuzzer_sys::fuzz_target;
mod common;
fuzz_target!(|data: &[u8]| {
common::run_data(data);
}); | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-json/fuzz/fuzz_targets/json_deserialize.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-json/fuzz/fuzz_targets/json_deserialize.rs | 1 | 13 |
awslabs/aws-sdk-rust:sdk/aws-smithy-json/fuzz/fuzz_targets/json_deserialize_corpus_cov.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use std::fs::File;
use std::io::Read;
mod common;
fn main() {
let current_dir = std::env::current_dir().unwrap();
println!("cwd: {:?}", current_dir);
let corpus_path = "corpus/json_deseria... | rust | rust | rust-source | awslabs/aws-sdk-rust | sdk/aws-smithy-json/fuzz/fuzz_targets/json_deserialize_corpus_cov.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-json/fuzz/fuzz_targets/json_deserialize_corpus_cov.rs | 1 | 26 |
awslabs/aws-sdk-rust:sdk/aws-smithy-json/src/deserialize.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use crate::deserialize::error::{DeserializeError as Error, DeserializeErrorKind as ErrorKind};
use aws_smithy_types::Number;
use ErrorKind::*;
pub mod error;
pub mod token;
pub use token::{EscapeError,... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-json/src/deserialize.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-json/src/deserialize.rs | 1 | 60 |
awslabs/aws-sdk-rust:sdk/aws-smithy-json/src/deserialize.rs:2 | /// Expecting the next token to be the *first* value in an array, or the end of the array.
ArrayFirstValueOrEnd,
/// Expecting the next token to the next value in an array, or the end of the array.
ArrayNextValueOrEnd,
/// Expecting the next token to be the *first* key in the object, or the end of the o... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | sdk/aws-smithy-json/src/deserialize.rs | Apache-2.0 | 5e17b3723799bff475dc95cdcca40c9d54602f18 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5e17b3723799bff475dc95cdcca40c9d54602f18/sdk/aws-smithy-json/src/deserialize.rs | 41 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.