pub trait Preprocessor {
type Payload: Default;
// Required method
fn preprocess(
&self,
path: &Path,
bytes: &[u8],
) -> Result<Option<PreprocessOutput<Self::Payload>>>;
}Expand description
Per-file callback signature used by index_path_with_preprocessor.
Receives the file path and the raw bytes; may return Some(...) to
supply a substitute body (e.g. with frontmatter stripped) and a
payload with sidecar metadata. Returning None skips the file.
Required Associated Types§
Required Methods§
fn preprocess( &self, path: &Path, bytes: &[u8], ) -> Result<Option<PreprocessOutput<Self::Payload>>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".