Skip to main content

DescriptorPool

Struct DescriptorPool 

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

Source

pub fn new(alloc: &'alloc dyn Allocator) -> Self

Create a new empty descriptor pool with the given allocator.

Source

pub fn add_file( &mut self, file: &'alloc FileDescriptorProto, ) -> Result<(), Error<LayoutError>>

Add a FileDescriptorProto to the pool

Source

pub fn get_table(&self, message_type: &str) -> Option<&Table>

Get a table by message type name

Source

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.