pub struct ParsedSchema {
pub root_type_name: String,
pub messages: HashMap<String, Arc<MessageSchema>>,
pub all_schemas: Arc<HashMap<String, Arc<MessageSchema>>>,
}Expand description
The parsed, indexed form of a FileDescriptorProto/Set.
root_type_name is the fully-qualified name of the root message (the one
that corresponds to a foo.pb payload). messages maps every reachable
type to its MessageSchema.
Fields§
§root_type_name: String§messages: HashMap<String, Arc<MessageSchema>>§all_schemas: Arc<HashMap<String, Arc<MessageSchema>>>OPT-6: Pre-built Arcget_schemas()
in lib.rs does not rebuild it on every encode_pb("protoc") call.
Built once at parse_schema() time and shared across all calls.
Implementations§
Source§impl ParsedSchema
impl ParsedSchema
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Construct an empty (no-schema) ParsedSchema.
Equivalent to parse_schema(b"", "") but infallible and allocation-free.
Sourcepub fn root_schema(&self) -> Option<Arc<MessageSchema>>
pub fn root_schema(&self) -> Option<Arc<MessageSchema>>
Return the MessageSchema for the root message, or None for an empty
schema (no-schema mode, equivalent to ctx.schema = None).
Auto Trait Implementations§
impl Freeze for ParsedSchema
impl RefUnwindSafe for ParsedSchema
impl Send for ParsedSchema
impl Sync for ParsedSchema
impl Unpin for ParsedSchema
impl UnsafeUnpin for ParsedSchema
impl UnwindSafe for ParsedSchema
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