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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! Backend trait for output backends.
use crateRenderError;
use crateQuill;
use crate::;
/// Backend trait for rendering different output formats.
///
/// # Implementing this outside the workspace
///
/// Unsupported, and the trait's shape is why. [`Backend::open`] returns a
/// [`LiveSession`], which only a `SessionHandle` implementation can build,
/// through `LiveSession::new`, and both of those are `#[doc(hidden)]`, so an
/// out-of-workspace backend writes against items this crate neither documents
/// nor holds stable.
///
/// The [`sealed::Sealed`] supertrait states that in the type system. It is a
/// declaration, not a barrier: a crate willing to name a `#[doc(hidden)]`
/// module can implement both. What it buys is that adding a method here stays a
/// minor release, since no implementation outside the workspace is one this
/// crate promised to keep compiling.
/// The refusal every backend owes a format outside its
/// [`Backend::supported_formats`], under `backend::format_not_supported`:
/// the one code a caller matches for this condition, so it is built once here
/// rather than once per backend.
///
/// `backend` names the backend in the message; `supported` becomes the hint.
/// Pre-session hint for whether a backend with these `formats` can paint pages
/// to a canvas, used before a session exists (e.g. a GUI deciding whether to
/// mount a canvas preview without first paying to open one).
///
/// Canvas paint needs a per-page *visual image* of the laid-out page, so the
/// predicate keys off the visual-page output formats ([`OutputFormat::Png`]
/// (raster) and [`OutputFormat::Svg`] (vector)) as opposed to
/// [`OutputFormat::Pdf`] (a document). A backend that can rasterize a page
/// advertises one of these in [`Backend::supported_formats`].
///
/// This is only a hint. The **authoritative** answer is
/// [`LiveSession::supports_canvas`](crate::LiveSession::supports_canvas),
/// which is derived from the session's actual canvas seam
/// ([`SessionHandle::page_size_pt`](crate::session::SessionHandle::page_size_pt));
/// there is no separately maintained capability flag to drift from the
/// implementation (a canvas backend pairs `render_rgba` with `page_size_pt`).