#[non_exhaustive]pub enum ReflectMode {
Off,
Bridge,
VTable,
}Expand description
How much reflection support generated types get.
Selected through buffa_build’s reflect_mode builder method (or the
protoc-gen-buffa reflect_mode= option). All modes need the consuming
crate to depend on buffa-descriptor with its reflect feature and on
std; the call site is foo.reflect().get(fd) regardless of mode.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Off
No reflection impls.
Bridge
Reflectable::reflect() round-trips the message through a
DynamicMessage (encode → decode → boxed handle). Smaller generated
code; pays an allocation and a re-encode per reflect() call.
VTable
impl ReflectMessage directly on the owned and view types, and
Reflectable::reflect() borrows self with no round-trip. Larger
generated code; near-free reflective access. Does not require view
generation — with views off, only the owned impls are emitted.
Implementations§
Source§impl ReflectMode
impl ReflectMode
Sourcepub fn apply(self, config: &mut CodeGenConfig)
pub fn apply(self, config: &mut CodeGenConfig)
Apply this mode to a CodeGenConfig (sets generate_reflection /
generate_reflection_vtable). Used by the buffa-build and
protoc-gen-buffa front-ends.
Trait Implementations§
Source§impl Clone for ReflectMode
impl Clone for ReflectMode
Source§fn clone(&self) -> ReflectMode
fn clone(&self) -> ReflectMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReflectMode
impl Debug for ReflectMode
Source§impl Default for ReflectMode
impl Default for ReflectMode
Source§fn default() -> ReflectMode
fn default() -> ReflectMode
Source§impl PartialEq for ReflectMode
impl PartialEq for ReflectMode
Source§fn eq(&self, other: &ReflectMode) -> bool
fn eq(&self, other: &ReflectMode) -> bool
self and other values to be equal, and is used by ==.