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,
}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: u32Field number on the extendee.
full_name: &'static strFully-qualified proto name. Emitted as [<this>].
extendee: &'static strFully-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<'_>) -> ResultExtract 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: ExtTextMergeFnConsume 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.