pub struct Schema { /* private fields */ }Implementations§
Source§impl Schema
impl Schema
Sourcepub const fn new(id: ShapeId, shape_type: ShapeType) -> Self
pub const fn new(id: ShapeId, shape_type: ShapeType) -> Self
Creates a schema for a simple type (no members).
Sourcepub const fn new_struct(
id: ShapeId,
shape_type: ShapeType,
members: &'static [&'static Schema],
) -> Self
pub const fn new_struct( id: ShapeId, shape_type: ShapeType, members: &'static [&'static Schema], ) -> Self
Creates a schema for a structure or union type.
Sourcepub const fn new_list(id: ShapeId, member: &'static Schema) -> Self
pub const fn new_list(id: ShapeId, member: &'static Schema) -> Self
Creates a schema for a list type.
Sourcepub const fn new_map(
id: ShapeId,
key: &'static Schema,
value: &'static Schema,
) -> Self
pub const fn new_map( id: ShapeId, key: &'static Schema, value: &'static Schema, ) -> Self
Creates a schema for a map type.
Sourcepub const fn new_member(
id: ShapeId,
shape_type: ShapeType,
member_name: &'static str,
member_index: usize,
) -> Self
pub const fn new_member( id: ShapeId, shape_type: ShapeType, member_name: &'static str, member_index: usize, ) -> Self
Creates a member schema wrapping a target schema.
Sourcepub fn shape_type(&self) -> ShapeType
pub fn shape_type(&self) -> ShapeType
Returns the shape type.
Sourcepub fn traits(&self) -> Option<&TraitMap>
pub fn traits(&self) -> Option<&TraitMap>
Returns the fallback trait map for unknown/custom traits.
Sourcepub fn sensitive(&self) -> Option<&SensitiveTrait>
pub fn sensitive(&self) -> Option<&SensitiveTrait>
Returns the @sensitive trait if present.
Sourcepub fn json_name(&self) -> Option<&JsonNameTrait>
pub fn json_name(&self) -> Option<&JsonNameTrait>
Returns the @jsonName value if present.
Sourcepub fn timestamp_format(&self) -> Option<&TimestampFormatTrait>
pub fn timestamp_format(&self) -> Option<&TimestampFormatTrait>
Returns the @timestampFormat if present.
Sourcepub fn xml_name(&self) -> Option<&XmlNameTrait>
pub fn xml_name(&self) -> Option<&XmlNameTrait>
Returns the @xmlName value if present.
Sourcepub fn has_http_response_binding(&self) -> bool
pub fn has_http_response_binding(&self) -> bool
Returns the @httpHeader value if present.
Returns true if this member schema has any HTTP response binding trait
(@httpHeader, @httpResponseCode, @httpPrefixHeaders, or @httpPayload).
pub fn http_header(&self) -> Option<&HttpHeaderTrait>
Sourcepub fn http_query(&self) -> Option<&HttpQueryTrait>
pub fn http_query(&self) -> Option<&HttpQueryTrait>
Returns the @httpQuery value if present.
Sourcepub fn http_label(&self) -> Option<&HttpLabelTrait>
pub fn http_label(&self) -> Option<&HttpLabelTrait>
Returns the @httpLabel trait if present.
Sourcepub fn http_payload(&self) -> Option<&HttpPayloadTrait>
pub fn http_payload(&self) -> Option<&HttpPayloadTrait>
Returns the @httpPayload trait if present.
Sourcepub fn http_prefix_headers(&self) -> Option<&HttpPrefixHeadersTrait>
pub fn http_prefix_headers(&self) -> Option<&HttpPrefixHeadersTrait>
Returns the @httpPrefixHeaders value if present.
Sourcepub fn media_type(&self) -> Option<&MediaTypeTrait>
pub fn media_type(&self) -> Option<&MediaTypeTrait>
Returns the @mediaType trait if present.
Sourcepub fn http_query_params(&self) -> Option<&HttpQueryParamsTrait>
pub fn http_query_params(&self) -> Option<&HttpQueryParamsTrait>
Returns the @httpQueryParams trait if present.
Sourcepub fn http_response_code(&self) -> Option<&HttpResponseCodeTrait>
pub fn http_response_code(&self) -> Option<&HttpResponseCodeTrait>
Returns the @httpResponseCode trait if present.
Sourcepub fn http(&self) -> Option<&HttpTrait>
pub fn http(&self) -> Option<&HttpTrait>
Returns the @http trait if present.
This is an operation-level trait included on the input schema for convenience so the protocol serializer can construct the request URI.
Sourcepub const fn with_sensitive(self) -> Self
pub const fn with_sensitive(self) -> Self
Sets the @sensitive trait.
Sourcepub const fn with_json_name(self, value: &'static str) -> Self
pub const fn with_json_name(self, value: &'static str) -> Self
Sets the @jsonName trait.
Sourcepub const fn with_timestamp_format(self, format: TimestampFormat) -> Self
pub const fn with_timestamp_format(self, format: TimestampFormat) -> Self
Sets the @timestampFormat trait.
Sourcepub const fn with_xml_name(self, value: &'static str) -> Self
pub const fn with_xml_name(self, value: &'static str) -> Self
Sets the @xmlName trait.
Sourcepub const fn with_xml_attribute(self) -> Self
pub const fn with_xml_attribute(self) -> Self
Sets the @xmlAttribute trait.
Sourcepub const fn with_xml_flattened(self) -> Self
pub const fn with_xml_flattened(self) -> Self
Sets the @xmlFlattened trait.
Sourcepub const fn with_http_header(self, value: &'static str) -> Self
pub const fn with_http_header(self, value: &'static str) -> Self
Sets the @httpHeader trait.
Sourcepub const fn with_http_label(self) -> Self
pub const fn with_http_label(self) -> Self
Sets the @httpLabel trait.
Sourcepub const fn with_http_payload(self) -> Self
pub const fn with_http_payload(self) -> Self
Sets the @httpPayload trait.
Sourcepub const fn with_http_prefix_headers(self, value: &'static str) -> Self
pub const fn with_http_prefix_headers(self, value: &'static str) -> Self
Sets the @httpPrefixHeaders trait.
Sourcepub const fn with_http_query(self, value: &'static str) -> Self
pub const fn with_http_query(self, value: &'static str) -> Self
Sets the @httpQuery trait.
Sourcepub const fn with_http_query_params(self) -> Self
pub const fn with_http_query_params(self) -> Self
Sets the @httpQueryParams trait.
Sourcepub const fn with_http_response_code(self) -> Self
pub const fn with_http_response_code(self) -> Self
Sets the @httpResponseCode trait.
Sourcepub const fn with_http(self, http: HttpTrait) -> Self
pub const fn with_http(self, http: HttpTrait) -> Self
Sets the @http trait (operation-level, included on input schema for convenience).
Sourcepub const fn with_streaming(self) -> Self
pub const fn with_streaming(self) -> Self
Sets the @streaming trait.
Sourcepub const fn with_event_header(self) -> Self
pub const fn with_event_header(self) -> Self
Sets the @eventHeader trait.
Sourcepub const fn with_event_payload(self) -> Self
pub const fn with_event_payload(self) -> Self
Sets the @eventPayload trait.
Sourcepub const fn with_host_label(self) -> Self
pub const fn with_host_label(self) -> Self
Sets the @hostLabel trait.
Sourcepub const fn with_media_type(self, value: &'static str) -> Self
pub const fn with_media_type(self, value: &'static str) -> Self
Sets the @mediaType trait.
Sourcepub const fn with_xml_namespace(self) -> Self
pub const fn with_xml_namespace(self) -> Self
Sets the @xmlNamespace trait.
Sourcepub const fn with_traits(self, traits: &'static LazyLock<TraitMap>) -> Self
pub const fn with_traits(self, traits: &'static LazyLock<TraitMap>) -> Self
Sets the fallback trait map for unknown/custom traits.
Sourcepub fn member_name(&self) -> Option<&str>
pub fn member_name(&self) -> Option<&str>
Returns the member name if this is a member schema.
Sourcepub fn member_index(&self) -> Option<usize>
pub fn member_index(&self) -> Option<usize>
Returns the member index for member schemas.
This is used internally by generated code for efficient member lookup. Consumer code should not rely on specific position values as they may change.
Sourcepub fn member_schema(&self, name: &str) -> Option<&Schema>
pub fn member_schema(&self, name: &str) -> Option<&Schema>
Returns the member schema by name (for structures and unions).
Sourcepub fn member_schema_by_index(&self, index: usize) -> Option<&Schema>
pub fn member_schema_by_index(&self, index: usize) -> Option<&Schema>
Returns the member name and schema by position index (for structures and unions).
This is an optimization for generated code to avoid string lookups. Consumer code should not rely on specific position values as they may change.
Sourcepub fn member(&self) -> Option<&Schema>
pub fn member(&self) -> Option<&Schema>
Returns the member schema for collections (list member or map value).
Sourcepub fn is_structure(&self) -> bool
pub fn is_structure(&self) -> bool
Returns true if this is a structure schema.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Schema
impl !RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl !UnwindSafe for Schema
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
§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>
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>
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