Schema

Struct Schema 

Source
pub struct Schema { /* private fields */ }

Implementations§

Source§

impl Schema

Source

pub const fn new(id: ShapeId, shape_type: ShapeType) -> Self

Creates a schema for a simple type (no members).

Source

pub const fn new_struct( id: ShapeId, shape_type: ShapeType, members: &'static [&'static Schema], ) -> Self

Creates a schema for a structure or union type.

Source

pub const fn new_list(id: ShapeId, member: &'static Schema) -> Self

Creates a schema for a list type.

Source

pub const fn new_map( id: ShapeId, key: &'static Schema, value: &'static Schema, ) -> Self

Creates a schema for a map type.

Source

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.

Source

pub fn shape_id(&self) -> &ShapeId

Returns the Shape ID of this schema.

Source

pub fn shape_type(&self) -> ShapeType

Returns the shape type.

Source

pub fn traits(&self) -> Option<&TraitMap>

Returns the fallback trait map for unknown/custom traits.

Source

pub fn sensitive(&self) -> Option<&SensitiveTrait>

Returns the @sensitive trait if present.

Source

pub fn json_name(&self) -> Option<&JsonNameTrait>

Returns the @jsonName value if present.

Source

pub fn timestamp_format(&self) -> Option<&TimestampFormatTrait>

Returns the @timestampFormat if present.

Source

pub fn xml_name(&self) -> Option<&XmlNameTrait>

Returns the @xmlName value if present.

Source

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).

Source

pub fn http_header(&self) -> Option<&HttpHeaderTrait>

Source

pub fn http_query(&self) -> Option<&HttpQueryTrait>

Returns the @httpQuery value if present.

Source

pub fn http_label(&self) -> Option<&HttpLabelTrait>

Returns the @httpLabel trait if present.

Source

pub fn http_payload(&self) -> Option<&HttpPayloadTrait>

Returns the @httpPayload trait if present.

Source

pub fn http_prefix_headers(&self) -> Option<&HttpPrefixHeadersTrait>

Returns the @httpPrefixHeaders value if present.

Source

pub fn media_type(&self) -> Option<&MediaTypeTrait>

Returns the @mediaType trait if present.

Source

pub fn http_query_params(&self) -> Option<&HttpQueryParamsTrait>

Returns the @httpQueryParams trait if present.

Source

pub fn http_response_code(&self) -> Option<&HttpResponseCodeTrait>

Returns the @httpResponseCode trait if present.

Source

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.

Source

pub const fn with_sensitive(self) -> Self

Sets the @sensitive trait.

Source

pub const fn with_json_name(self, value: &'static str) -> Self

Sets the @jsonName trait.

Source

pub const fn with_timestamp_format(self, format: TimestampFormat) -> Self

Sets the @timestampFormat trait.

Source

pub const fn with_xml_name(self, value: &'static str) -> Self

Sets the @xmlName trait.

Source

pub const fn with_xml_attribute(self) -> Self

Sets the @xmlAttribute trait.

Source

pub const fn with_xml_flattened(self) -> Self

Sets the @xmlFlattened trait.

Source

pub const fn with_http_header(self, value: &'static str) -> Self

Sets the @httpHeader trait.

Source

pub const fn with_http_label(self) -> Self

Sets the @httpLabel trait.

Source

pub const fn with_http_payload(self) -> Self

Sets the @httpPayload trait.

Source

pub const fn with_http_prefix_headers(self, value: &'static str) -> Self

Sets the @httpPrefixHeaders trait.

Source

pub const fn with_http_query(self, value: &'static str) -> Self

Sets the @httpQuery trait.

Source

pub const fn with_http_query_params(self) -> Self

Sets the @httpQueryParams trait.

Source

pub const fn with_http_response_code(self) -> Self

Sets the @httpResponseCode trait.

Source

pub const fn with_http(self, http: HttpTrait) -> Self

Sets the @http trait (operation-level, included on input schema for convenience).

Source

pub const fn with_streaming(self) -> Self

Sets the @streaming trait.

Source

pub const fn with_event_header(self) -> Self

Sets the @eventHeader trait.

Source

pub const fn with_event_payload(self) -> Self

Sets the @eventPayload trait.

Source

pub const fn with_host_label(self) -> Self

Sets the @hostLabel trait.

Source

pub const fn with_media_type(self, value: &'static str) -> Self

Sets the @mediaType trait.

Source

pub const fn with_xml_namespace(self) -> Self

Sets the @xmlNamespace trait.

Source

pub const fn with_traits(self, traits: &'static LazyLock<TraitMap>) -> Self

Sets the fallback trait map for unknown/custom traits.

Source

pub fn member_name(&self) -> Option<&str>

Returns the member name if this is a member schema.

Source

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.

Source

pub fn member_schema(&self, name: &str) -> Option<&Schema>

Returns the member schema by name (for structures and unions).

Source

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.

Source

pub fn members(&self) -> &[&Schema]

Returns the member schemas (for structures and unions).

Source

pub fn member(&self) -> Option<&Schema>

Returns the member schema for collections (list member or map value).

Source

pub fn key(&self) -> Option<&Schema>

Returns the key schema for maps.

Source

pub fn is_member(&self) -> bool

Returns true if this is a member schema.

Source

pub fn is_structure(&self) -> bool

Returns true if this is a structure schema.

Source

pub fn is_union(&self) -> bool

Returns true if this is a union schema.

Source

pub fn is_list(&self) -> bool

Returns true if this is a list schema.

Source

pub fn is_map(&self) -> bool

Returns true if this is a map schema.

Source

pub fn is_blob(&self) -> bool

Returns true if this is a blob schema.

Source

pub fn is_string(&self) -> bool

Returns true if this is a string schema.

Trait Implementations§

Source§

impl Debug for Schema

Source§

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

Formats the value using the given formatter. Read more

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> 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> 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, 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