pub struct ShapeId { /* private fields */ }Expand description
A Smithy Shape ID.
Shape IDs uniquely identify shapes in a Smithy model.
fqnis"smithy.example#Foo"namespaceis"smithy.example"shape_nameis"Foo"
Implementations§
Source§impl ShapeId
impl ShapeId
Sourcepub const fn from_static(
fqn: &'static str,
namespace: &'static str,
shape_name: &'static str,
) -> Self
pub const fn from_static( fqn: &'static str, namespace: &'static str, shape_name: &'static str, ) -> Self
Creates a ShapeId from a static string at compile time.
This is used for const initialization of prelude schemas.
Sourcepub fn new_from_parts(
namespace: impl Into<Cow<'static, str>>,
shape_name: impl Into<Cow<'static, str>>,
) -> Self
pub fn new_from_parts( namespace: impl Into<Cow<'static, str>>, shape_name: impl Into<Cow<'static, str>>, ) -> Self
Creates a new ShapeId from a namespace and a shape_name.
§Examples
use aws_smithy_schema::ShapeId;
let shape_id = ShapeId::new("smithy.api#String");Sourcepub fn new_from_fqn(fqn: impl Into<Cow<'static, str>>) -> Option<Self>
pub fn new_from_fqn(fqn: impl Into<Cow<'static, str>>) -> Option<Self>
Creates a new ShapeId from a fully qualified name.
Sourcepub fn new(fqn: impl Into<Cow<'static, str>>) -> Self
pub fn new(fqn: impl Into<Cow<'static, str>>) -> Self
Creates a new ShapeId from a fully qualified name.
Sourcepub fn namespace(&self) -> &str
pub fn namespace(&self) -> &str
Returns the namespace portion of the ShapeId.
§Examples
use aws_smithy_schema::ShapeId;
let shape_id = ShapeId::new("smithy.api#String");
assert_eq!(shape_id.namespace(), "smithy.api");Sourcepub fn shape_name(&self) -> &str
pub fn shape_name(&self) -> &str
Returns the shape name portion of the ShapeId.
§Examples
use aws_smithy_schema::ShapeId;
let shape_id = ShapeId::new("smithy.api#String");
assert_eq!(shape_id.shape_name(), "String");Sourcepub fn member_name(&self) -> Option<&str>
pub fn member_name(&self) -> Option<&str>
Returns the member name if this is a member shape ID.
§Examples
use aws_smithy_schema::ShapeId;
let shape_id = ShapeId::new("com.example#MyStruct$member");
assert_eq!(shape_id.member_name(), Some("member"));Trait Implementations§
impl Eq for ShapeId
impl StructuralPartialEq for ShapeId
Auto Trait Implementations§
impl Freeze for ShapeId
impl RefUnwindSafe for ShapeId
impl Send for ShapeId
impl Sync for ShapeId
impl Unpin for ShapeId
impl UnwindSafe for ShapeId
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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 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>
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