pub trait InputNode {
    fn type_to_node() -> Node;
    fn data_to_node(&self) -> Node;
    fn oneof_variant(&self) -> Option<&'static str>;
    fn parse_unknown(&self, context: &mut Context<'_>) -> bool;
}
Expand description

Trait for all Rust types that represent input tree node types.

Required Methods

Creates an empty output node for a protobuf datum of this type.

For primitive types, this fills the value with protobuf’s default.

Creates an empty output node for a protobuf datum with this value.

Returns the name of the selected variant of a oneof field, if this is a rust enum used to represent a oneof field.

Complete the subtrees of this datum in output that have not already been parsed using UnknownField nodes. Returns whether any such nodes were added.

Implementations on Foreign Types

Implementors

Blanket implementation to make all protobuf primitives behave like generic protobuf datums.

Note: if Rust would allow it, we could define blanket implementations for ProtoMessage and ProtoOneOf as well, since they’re always the same. Unfortunately, we can only define a single blanket implementation, so we opt for the one that isn’t already generated via derive macros.