Skip to main content

TextExtEntry

Struct TextExtEntry 

Source
pub struct TextExtEntry {
    pub number: u32,
    pub full_name: &'static str,
    pub extendee: &'static str,
    pub text_encode: fn(u32, &UnknownFields, &mut TextEncoder<'_>) -> Result,
    pub text_merge: ExtTextMergeFn,
}
Available on crate feature text and (crate features json or text) only.
Expand description

Registry entry for a single extension field’s textproto conversion.

Carries fn-ptrs for the [pkg.ext] { ... } bracket syntax. Covers message- and group-typed extensions, singular and repeated. Scalar and enum extensions have no text entry.

Fields§

§number: u32

Field number on the extendee.

§full_name: &'static str

Fully-qualified proto name. Emitted as [<this>].

§extendee: &'static str

Fully-qualified extendee message name (no leading dot). Checked on decode; a mismatch is a contract violation and fails the parse.

§text_encode: fn(u32, &UnknownFields, &mut TextEncoder<'_>) -> Result

Extract this extension’s value from unknown fields and write it.

TextEncoder::write_extension_fields calls this once per extension number, after it has written [full_name], so the function writes one value and does not write the name. The repeated helpers (repeated_message_encode_text, repeated_group_encode_text) are the exception: for each element after the first they have the encoder write [full_name] again.

§text_merge: ExtTextMergeFn

Consume one value and produce unknown-field records.

TextDecoder::read_extension calls this once per [full_name] occurrence in the input. Generated merge_text appends the records of every occurrence to the message’s unknown fields.

Trait Implementations§

Source§

impl Debug for TextExtEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.