pub struct TypeSchema { /* private fields */ }schema only.Expand description
One type’s schema entry in a SchemaSet.
Implementations§
Source§impl TypeSchema
impl TypeSchema
Sourcepub fn json_schema(document: Value) -> TypeSchema
pub fn json_schema(document: Value) -> TypeSchema
A json-schema entry from an explicit schema document.
Sourcepub fn json_schema_of<T: JsonSchema>() -> TypeSchema
Available on crate feature schemars only.
pub fn json_schema_of<T: JsonSchema>() -> TypeSchema
schemars only.A json-schema entry derived from a serde type (feature schemars;
honors #[serde(...)] attributes).
Sourcepub fn protobuf(message: impl Into<String>, descriptor_set: &[u8]) -> TypeSchema
pub fn protobuf(message: impl Into<String>, descriptor_set: &[u8]) -> TypeSchema
A protobuf entry: the fully-qualified message name and the raw
FileDescriptorSet bytes (from prost-build’s
file_descriptor_set_path). Serving needs no protobuf dependency —
the bytes are carried base64.
Sourcepub fn cdr(document: Value) -> TypeSchema
pub fn cdr(document: Value) -> TypeSchema
A cdr entry (v1.10) from its document: fields (required), types
(optional local type table), and source (optional, informative).
The hash covers fields and types only. The source text is the
human’s copy of the schema, not the schema: two producers generating
the same message from .msg and from IDL describe the same wire
format, and drift detection must not call that a disagreement.
Sourcepub fn kind(&self) -> SchemaKind
pub fn kind(&self) -> SchemaKind
The kind token this entry serializes under.
Sourcepub fn body(&self) -> &SchemaBody
pub fn body(&self) -> &SchemaBody
The entry’s kind-specific fields, typed.
Sourcepub fn hash(&self) -> Option<&str>
pub fn hash(&self) -> Option<&str>
The sha256: cache/drift key, when the served document carried one.
None is no identity, which is why it is not a &str: an empty
string used to mean this, and every caller had to remember to check
for it (#323).
Sourcepub fn json_document(&self) -> Option<&Value>
pub fn json_document(&self) -> Option<&Value>
The JSON Schema document, when this is a json-schema entry.
Sourcepub fn protobuf_message(&self) -> Option<&str>
pub fn protobuf_message(&self) -> Option<&str>
The protobuf message name, when this is a protobuf entry.
Sourcepub fn cdr_fields(&self) -> Option<&Value>
pub fn cdr_fields(&self) -> Option<&Value>
The ordered field list, when this is a cdr entry.
Sourcepub fn cdr_types(&self) -> Option<&Map<String, Value>>
pub fn cdr_types(&self) -> Option<&Map<String, Value>>
The local type table of a cdr entry (absent when the message uses
primitives only).
Sourcepub fn protobuf_descriptor_set(&self) -> Option<Vec<u8>>
pub fn protobuf_descriptor_set(&self) -> Option<Vec<u8>>
The decoded FileDescriptorSet bytes, when this is a protobuf entry.
Trait Implementations§
Source§impl Clone for TypeSchema
impl Clone for TypeSchema
Source§fn clone(&self) -> TypeSchema
fn clone(&self) -> TypeSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TypeSchema
impl Debug for TypeSchema
impl Eq for TypeSchema
Source§impl PartialEq for TypeSchema
impl PartialEq for TypeSchema
impl StructuralPartialEq for TypeSchema
Auto Trait Implementations§
impl Freeze for TypeSchema
impl RefUnwindSafe for TypeSchema
impl Send for TypeSchema
impl Sync for TypeSchema
impl Unpin for TypeSchema
impl UnsafeUnpin for TypeSchema
impl UnwindSafe for TypeSchema
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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