Skip to main content

ServiceShapeNamespace

Struct ServiceShapeNamespace 

Source
#[non_exhaustive]
pub struct ServiceShapeNamespace(/* private fields */);
Expand description

The namespace of the Smithy service shape a client was generated for.

This is the com.amazonaws.dynamodb in com.amazonaws.dynamodb#DynamoDB_20120810. Together with ServiceShapeName it forms the service’s full shape ID; the two are separate entries rather than one because [ConfigBag] is keyed by type, so each protocol loads exactly the facts it needs and new facts stay additive.

Not to be confused with ServiceXmlNamespace, despite the shared word. That one is the @xmlNamespace trait — a URI restXml applies as the default xmlns on root elements — and neither value is derivable from the other. CloudWatch Logs is the clearest illustration: its shape-ID namespace is com.amazonaws.cloudwatchlogs while its @xmlNamespace URI is http://monitoring.amazonaws.com/doc/2014-03-28/. The trait is also optional, carried by roughly half of AWS service shapes, whereas every shape ID has a namespace by construction — which is why this entry is stored unconditionally and ServiceXmlNamespace is not.

Protocols use this as the default namespace when resolving a document type’s shape discriminator. Some services serialize a discriminator as a bare shape name rather than an absolute shape ID — a __type of Widget instead of com.example#Widget — and the receiving client is expected to qualify it with the service’s namespace. Without it a relative discriminator cannot be resolved to a registered type at all.

Stored for the same reason as ServiceShapeName: it is knowable only from the model, and a customer may select a different protocol at runtime via Config::builder().protocol(..) on a client generated for some other protocol. Baking it into a constructor call at codegen time means a swapped-in protocol either gets no value or gets one the caller had to know to supply. Generated clients therefore store it regardless of which protocol they were generated for.

Implementations§

Source§

impl ServiceShapeNamespace

Source

pub fn new(namespace: impl Into<Cow<'static, str>>) -> Self

Creates a new ServiceShapeNamespace from the Smithy service shape’s namespace.

Accepts a codegen-emitted &'static str as well as a String materialized at runtime from a parsed model.

Source

pub fn as_str(&self) -> &str

Returns the service shape’s namespace.

Trait Implementations§

Source§

impl Clone for ServiceShapeNamespace

Source§

fn clone(&self) -> ServiceShapeNamespace

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServiceShapeNamespace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ServiceShapeNamespace

Source§

fn eq(&self, other: &ServiceShapeNamespace) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Storable for ServiceShapeNamespace

Source§

type Storer = StoreReplace<ServiceShapeNamespace>

Specify how an item is stored in the config bag, e.g. [StoreReplace] and [StoreAppend]
Source§

impl Eq for ServiceShapeNamespace

Source§

impl StructuralPartialEq for ServiceShapeNamespace

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more