pub trait Manifest<'a>: Boxed<'a> {
// Required methods
fn resolve_output(&self, key: &str) -> Option<Cow<'a, str>>;
fn iter_keys(&self) -> Box<dyn Iterator<Item = &str> + '_>;
fn iter_outputs(&self) -> Box<dyn Iterator<Item = &str> + '_>;
fn chunk(&self, output: &str) -> Option<Cow<'a, ManifestChunk<'a>>>;
// Provided method
fn chunk_by_key(&self, key: &str) -> Option<Cow<'a, ManifestChunk<'a>>> { ... }
}Expand description
Trait, that helps query chunks in Vite manifest.
See Manifest derive and ManifestChunk.
Required Methods§
Sourcefn resolve_output(&self, key: &str) -> Option<Cow<'a, str>>
fn resolve_output(&self, key: &str) -> Option<Cow<'a, str>>
Get output_filename from manifest key.
MyViteManifest.resolve_output("src/main.tsx") // returns "main.HASH.js"Sourcefn iter_keys(&self) -> Box<dyn Iterator<Item = &str> + '_>
fn iter_keys(&self) -> Box<dyn Iterator<Item = &str> + '_>
Iterator over manifest keys (input filenames, e.g. “src/main.tsx”).
MyViteManifest.iter_keys()
// returns iterator over keys (e.g. "src/main.tsx", "src/component.tsx", ...)Sourcefn iter_outputs(&self) -> Box<dyn Iterator<Item = &str> + '_>
fn iter_outputs(&self) -> Box<dyn Iterator<Item = &str> + '_>
Iterator over manifest outputs (output filenames, e.g. “main.hashhh.js”).
MyViteManifest.iter_outputs()
// returns iterator over output files (e.g. "main.HASH.js", "chunks/_shared.HASH.js", ...)Sourcefn chunk(&self, output: &str) -> Option<Cow<'a, ManifestChunk<'a>>>
fn chunk(&self, output: &str) -> Option<Cow<'a, ManifestChunk<'a>>>
Get ManifestChunk from output filename.
dbg!(MyViteManifest.chunk("main.HASH.js"))Provided Methods§
Sourcefn chunk_by_key(&self, key: &str) -> Option<Cow<'a, ManifestChunk<'a>>>
fn chunk_by_key(&self, key: &str) -> Option<Cow<'a, ManifestChunk<'a>>>
Get ManifestChunk from manifest key.
dbg!(MyViteManifest.chunk_by_key("src/main.tsx"))Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".