use crate::ShapeId;
use std::any::Any;
use std::fmt;
pub trait Trait: Any + Send + Sync + fmt::Debug {
fn trait_id(&self) -> &ShapeId;
fn as_any(&self) -> &dyn Any;
}
#[derive(Debug, Clone)]
#[allow(dead_code)] pub struct AnnotationTrait {
id: ShapeId,
}
#[allow(dead_code)]
impl AnnotationTrait {
pub fn new(id: ShapeId) -> Self {
Self { id }
}
}
impl Trait for AnnotationTrait {
fn trait_id(&self) -> &ShapeId {
&self.id
}
fn as_any(&self) -> &dyn Any {
self
}
}
#[derive(Debug, Clone)]
#[allow(dead_code)] pub struct StringTrait {
id: ShapeId,
value: String,
}
#[allow(dead_code)]
impl StringTrait {
pub fn new(id: ShapeId, value: impl Into<String>) -> Self {
Self {
id,
value: value.into(),
}
}
pub fn value(&self) -> &str {
&self.value
}
}
impl Trait for StringTrait {
fn trait_id(&self) -> &ShapeId {
&self.id
}
fn as_any(&self) -> &dyn Any {
self
}
}
#[derive(Debug, Clone)]
#[allow(dead_code)] pub struct DocumentTrait {
id: ShapeId,
value: aws_smithy_types::Document,
}
#[allow(dead_code)]
impl DocumentTrait {
pub fn new(id: ShapeId, value: aws_smithy_types::Document) -> Self {
Self { id, value }
}
pub fn value(&self) -> &aws_smithy_types::Document {
&self.value
}
}
impl Trait for DocumentTrait {
fn trait_id(&self) -> &ShapeId {
&self.id
}
fn as_any(&self) -> &dyn Any {
self
}
}