Skip to main content

aws_types/
lib.rs

1/*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6/* Automatically managed default lints */
7#![cfg_attr(docsrs, feature(doc_cfg))]
8/* End of automatically managed default lints */
9//! Cross-service types for the AWS SDK.
10
11#![allow(clippy::derive_partial_eq_without_eq)]
12#![warn(
13    missing_docs,
14    rustdoc::missing_crate_level_docs,
15    missing_debug_implementations,
16    rust_2018_idioms,
17    unreachable_pub
18)]
19
20pub mod app_name;
21pub mod build_metadata;
22pub mod endpoint_config;
23pub mod origin;
24pub mod os_shim_internal;
25pub mod region;
26pub mod request_id;
27pub mod sdk_config;
28pub mod sdk_ua_metadata;
29pub mod service_config;
30
31pub use sdk_config::SdkConfig;
32
33use aws_smithy_types::config_bag::{Storable, StoreReplace};
34use std::borrow::Cow;
35
36/// The name of the service used to sign this request
37///
38/// Generally, user code should never interact with `SigningName` directly
39#[derive(Clone, Debug, PartialEq, Eq)]
40pub struct SigningName(Cow<'static, str>);
41impl AsRef<str> for SigningName {
42    fn as_ref(&self) -> &str {
43        &self.0
44    }
45}
46
47impl SigningName {
48    /// Creates a `SigningName` from a static str.
49    pub fn from_static(name: &'static str) -> Self {
50        SigningName(Cow::Borrowed(name))
51    }
52}
53
54impl From<String> for SigningName {
55    fn from(name: String) -> Self {
56        SigningName(Cow::Owned(name))
57    }
58}
59
60impl From<&'static str> for SigningName {
61    fn from(name: &'static str) -> Self {
62        Self::from_static(name)
63    }
64}
65
66impl Storable for SigningName {
67    type Storer = StoreReplace<Self>;
68}