Skip to main content

extract

Function extract 

Source
pub fn extract(s: &Schema, keep: &[&str]) -> Result<Schema, SchemaError>
Expand description

The minimal subschema of s that only recognizes documents built from labels in keep. Returns a SchemaError if deleting the other labels would invalidate the root record (see the module doc comment).

Takes a concrete &[&str] rather than a generic IntoIterator on purpose: a generic parameter here would monomorphize a separate copy of extract per distinct caller argument type (Vec<String>, an array literal, an empty slice, …), and cargo llvm-cov counts per- instantiation coverage separately – so a fully-tested generic version could still report less than 100% simply because not every instantiation was independently exercised, without any real gap in behavior coverage. A single concrete signature sidesteps that entirely.