#[non_exhaustive]pub enum ReflectionError {
Decode(DecodeError),
ElementBudget,
Pool(PoolError),
MalformedFraming {
offset: usize,
},
UnnamedFile {
index: usize,
},
CountMismatch {
framed: usize,
decoded: usize,
},
SharedPool,
}Expand description
Errors from building a Reflector.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Decode(DecodeError)
The bytes did not decode as a FileDescriptorSet.
Exceeding the element-memory budget is reported separately as
ElementBudget, because there the bytes are
fine; this variant is every other wire-level failure.
ElementBudget
The descriptor set was well-formed but exceeded the decode’s element-memory budget.
Split apart from Decode because the remedy is
different: the bytes are fine, and a reflection service is normally
handed its own server’s descriptors, which are trusted. The remedy is
a smaller set — strip source_code_info, or narrow it to the files
this server reflects.
Pool(PoolError)
The decoded descriptors did not link into a valid pool (dangling type reference, duplicate symbol, malformed map entry, …).
MalformedFraming
The top-level wire structure of the set was malformed (e.g. a truncated length prefix), so per-file byte ranges could not be sliced out.
UnnamedFile
A file in the set has no name field; the reflection protocol
keys every file query by name.
CountMismatch
The framing walk and the message decoder disagreed on how many
files the set contains — the bytes are not a coherent
FileDescriptorSet.
Fields
add_descriptor_set_bytes
was called on a reflector whose pool is shared (adopted via
from_descriptor_pool with
other outstanding references). Merge sets before sharing, or build
the reflector from bytes.
Trait Implementations§
Source§impl Debug for ReflectionError
impl Debug for ReflectionError
Source§impl Display for ReflectionError
impl Display for ReflectionError
Source§impl Error for ReflectionError
impl Error for ReflectionError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<DecodeError> for ReflectionError
Written out rather than derived with #[from], so that the budget/corrupt
split cannot be bypassed. A derived conversion sends every
buffa::DecodeError to Decode, so the next
decode path added here — reached with ?, which compiles fine — would
report an over-budget set as corruption again, silently undoing the reason
ElementBudget exists.
impl From<DecodeError> for ReflectionError
Written out rather than derived with #[from], so that the budget/corrupt
split cannot be bypassed. A derived conversion sends every
buffa::DecodeError to Decode, so the next
decode path added here — reached with ?, which compiles fine — would
report an over-budget set as corruption again, silently undoing the reason
ElementBudget exists.