Skip to main content

shared_descriptor_root_module

Function shared_descriptor_root_module 

Source
pub fn shared_descriptor_root_module(
    fds_bytes: &[u8],
    embedding: FdsEmbedding<'_>,
    gate: Option<&str>,
) -> String
Expand description

Render the shared __buffa_fds root module as formatted Rust source, for a front-end to prepend to the module-tree file in shared-pool mode. Every package’s __buffa::reflect module delegates here, so the descriptor set is embedded once for the whole tree instead of once per package.

fds_bytes is the output of encode_descriptor_set. embedding chooses inline vs. an include_bytes! sidecar (see FdsEmbedding). gate wraps the module in #[cfg(feature = "<gate>")] when Some, to match CodeGenConfig::reflect_feature_gate (so the root module and the per-package delegations appear and disappear together); pass None when reflection is unconditional.

§Panics

Panics if the rendered module fails to parse — it is machine-generated, so a parse failure is a codegen bug.