1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use Debug;
use crateParser;
/// An `ImageFileHandler` is responsible for providing the raw bytes of an image
/// file when a referenced image must be embedded directly in the output as a
/// `data:` URI (i.e. when the `data-uri` document attribute is set and the safe
/// mode is below [`SafeMode::Secure`]).
///
/// This crate is a parser, not a converter, and never reads from the filesystem
/// itself. A client of [`Parser`] that wants images embedded as `data:` URIs
/// must provide an `ImageFileHandler` (analogous to [`SvgFileHandler`],
/// [`IncludeFileHandler`], and [`DocinfoFileHandler`]) that maps a resolved
/// image path to its bytes. If no handler is provided (or the handler cannot
/// find the file), the image degrades to an ordinary web path – the same output
/// as when `data-uri` is not set – matching this crate's convention that a
/// missing I/O handler is a silent, graceful degradation.
///
/// [`Parser`]: crate::Parser
/// [`SafeMode::Secure`]: crate::SafeMode::Secure
/// [`SvgFileHandler`]: crate::parser::SvgFileHandler
/// [`IncludeFileHandler`]: crate::parser::IncludeFileHandler
/// [`DocinfoFileHandler`]: crate::parser::DocinfoFileHandler