pub struct DescriptorPool<'alloc> {
pub arena: Arena<'alloc>,
/* private fields */
}Expand description
A registry of message types for dynamic protobuf operations.
Maintains an internal arena for table storage and a map from fully-qualified message names to their encoding/decoding tables.
Fields§
§arena: Arena<'alloc>Arena used for allocating message data during decode operations.
Implementations§
Source§impl<'alloc> DescriptorPool<'alloc>
impl<'alloc> DescriptorPool<'alloc>
Sourcepub fn new(alloc: &'alloc dyn Allocator) -> Self
pub fn new(alloc: &'alloc dyn Allocator) -> Self
Create a new empty descriptor pool with the given allocator.
Sourcepub fn add_file(
&mut self,
file: &'alloc FileDescriptorProto,
) -> Result<(), Error<LayoutError>>
pub fn add_file( &mut self, file: &'alloc FileDescriptorProto, ) -> Result<(), Error<LayoutError>>
Add a FileDescriptorProto to the pool
Sourcepub fn create_message<'pool, 'msg>(
&'pool self,
message_type: &str,
arena: &mut Arena<'msg>,
) -> Result<DynamicMessage<'pool, 'msg>, Error<LayoutError>>
pub fn create_message<'pool, 'msg>( &'pool self, message_type: &str, arena: &mut Arena<'msg>, ) -> Result<DynamicMessage<'pool, 'msg>, Error<LayoutError>>
Create an empty message of the given type, allocated in the arena.
Auto Trait Implementations§
impl<'alloc> !RefUnwindSafe for DescriptorPool<'alloc>
impl<'alloc> !Send for DescriptorPool<'alloc>
impl<'alloc> !Sync for DescriptorPool<'alloc>
impl<'alloc> !UnwindSafe for DescriptorPool<'alloc>
impl<'alloc> Freeze for DescriptorPool<'alloc>
impl<'alloc> Unpin for DescriptorPool<'alloc>
impl<'alloc> UnsafeUnpin for DescriptorPool<'alloc>
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