ProtobufRef

Trait ProtobufRef 

Source
pub trait ProtobufRef<'pool> {
    // Required method
    fn as_dyn<'msg>(&'msg self) -> DynamicMessageRef<'pool, 'msg>;

    // Provided methods
    fn descriptor(&self) -> &'pool ProtoType { ... }
    fn encode_flat<'a, const STACK_DEPTH: usize>(
        &self,
        buffer: &'a mut [u8],
    ) -> Result<&'a [u8], Error> { ... }
    fn encode_vec<const STACK_DEPTH: usize>(&self) -> Result<Vec<u8>, Error> { ... }
}
Expand description

Read-only protobuf operations (encode, serialize, inspect).

Required Methods§

Source

fn as_dyn<'msg>(&'msg self) -> DynamicMessageRef<'pool, 'msg>

Get a dynamic view of this message for reflection.

Provided Methods§

Source

fn descriptor(&self) -> &'pool ProtoType

Get the message’s descriptor (schema metadata).

Source

fn encode_flat<'a, const STACK_DEPTH: usize>( &self, buffer: &'a mut [u8], ) -> Result<&'a [u8], Error>

Encode to a fixed buffer. Returns the encoded slice or an error.

Source

fn encode_vec<const STACK_DEPTH: usize>(&self) -> Result<Vec<u8>, Error>

Encode to a new Vec, growing as needed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'pool, 'msg> ProtobufRef<'pool> for DynamicMessage<'pool, 'msg>

Source§

impl<'pool, 'msg> ProtobufRef<'pool> for DynamicMessageRef<'pool, 'msg>

Source§

impl<T: Protobuf> ProtobufRef<'static> for T