iced_renderer/
lib.rs

1//! The official renderer for iced.
2#![cfg_attr(docsrs, feature(doc_auto_cfg))]
3#[cfg(feature = "wgpu")]
4pub use iced_wgpu as wgpu;
5
6pub mod fallback;
7
8pub use iced_graphics as graphics;
9pub use iced_graphics::core;
10
11#[cfg(feature = "geometry")]
12pub use iced_graphics::geometry;
13
14/// The default graphics renderer for [`iced`].
15///
16/// [`iced`]: https://github.com/iced-rs/iced
17pub type Renderer = renderer::Renderer;
18
19/// The default graphics compositor for [`iced`].
20///
21/// [`iced`]: https://github.com/iced-rs/iced
22pub type Compositor = renderer::Compositor;
23
24#[cfg(all(feature = "wgpu", feature = "tiny-skia"))]
25mod renderer {
26    pub type Renderer = crate::fallback::Renderer<
27        iced_wgpu::Renderer,
28        iced_tiny_skia::Renderer,
29    >;
30
31    pub type Compositor = crate::fallback::Compositor<
32        iced_wgpu::window::Compositor,
33        iced_tiny_skia::window::Compositor,
34    >;
35}
36
37#[cfg(all(feature = "wgpu", not(feature = "tiny-skia")))]
38mod renderer {
39    pub type Renderer = iced_wgpu::Renderer;
40    pub type Compositor = iced_wgpu::window::Compositor;
41}
42
43#[cfg(all(not(feature = "wgpu"), feature = "tiny-skia"))]
44mod renderer {
45    pub type Renderer = iced_tiny_skia::Renderer;
46    pub type Compositor = iced_tiny_skia::window::Compositor;
47}
48
49#[cfg(not(any(feature = "wgpu", feature = "tiny-skia")))]
50mod renderer {
51    #[cfg(not(debug_assertions))]
52    compile_error!(
53        "Cannot compile `iced_renderer` in release mode \
54        without a renderer feature enabled. \
55        Enable either the `wgpu` or `tiny-skia` feature, or both."
56    );
57
58    pub type Renderer = ();
59    pub type Compositor = ();
60}