Skip to main content

filter_known_plugin_options

Function filter_known_plugin_options 

Source
pub fn filter_known_plugin_options<T: DeserializeOwned>(
    values: Vec<Value>,
) -> Result<Vec<T>, Error>
Expand description

Deserializes a list of plugin options leniently.

Each entry is normally a single-key {"tag": payload} object, but a multi-key object is also accepted and split: every top-level key is treated as an independent plugin option. Keys naming a known variant are deserialized and kept; keys naming a variant this build doesn’t recognize are dropped (and buffered via record_dropped_plugin for deferred logging). This lets a single config file be shared across builds that compile different sets of plugins — including a table that mixes a known plugin with unknown ones — without aborting startup.

A known variant whose payload is genuinely malformed still propagates its error, so a misconfigured plugin is never silently disabled; only genuinely unknown options are ignored. For privacy only the unrecognized variant tag is recorded, never the raw payload (which may contain secrets).

This is generic over T so the open-source plugins crate and the enterprise ent-plugins crate share a single implementation without either having to enumerate its variants (see is_unknown_variant_tag).