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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//! Iced_webview is a library to embed Web views in iced applications. It is a renderer agnostic webview library for Iced.
//!
//! > Note: Currently this library only supports [Ultralight](https://ultralig.ht)/Webkit, but more rendering engines are planned to be supported.
//! > [Ultralight has its own license](https://ultralig.ht/pricing/) that should be reviewed before deciding if it works for you
//!
//! Has two separate widgets: Basic, and Advanced.
//! The basic widget is very simple to implement and requires no knowledge of the widget.
//! You can use simple abstractions like CloseCurrent, and ChangeView.
//! Whereas with the Advanced widget, you have callbacks when a view is done being created, and you need to keep track of the ViewId for view calls
//!
//! #Basic usage should look familiar to iced users:
//!
//! You'll need to create a `Message` for Webview:
//! ```rust
//! enum Message {
//! WebView(iced_webview::Action),
//! Update
//! }
//! ```
//!
//! Create a new struct to store webview state
//! ```rust
//! struct State {
//! webview: iced_webview::WebView<iced_webview::Ultralight, Message>,
//! }
//! # #[derive(Clone)]
//! # enum Message { }
//! ```
//!
//! ###Then you should be able to call the usual `view/update` methods:
//!
//! ```rust
//! fn update(state: &mut State, message: Message) -> iced::Task<Message> {
//! match message {
//! Message::WebView(msg) => state.webview.update(msg),
//! Message::Update => state.webview.update(iced_webview::Action::Update),
//! }
//! }
//! # #[derive(Clone)]
//! # enum Message { WebView(iced_webview::Action), Update }
//! # struct State { webview: iced_webview::WebView<iced_webview::Ultralight, Message> }
//! ```
//!
//! ```rust
//! fn view(state: &mut State, message: Message) -> iced::Element<Message> {
//! state.webview.view().map(Message::WebView).into()
//! }
//! # #[derive(Clone)]
//! # enum Message { WebView(iced_webview::Action) }
//! # struct State { webview: iced_webview::WebView<iced_webview::Ultralight, Message> }
//! ```
//!
//! The subscription provides periodic updates so that all the backend rendering is done frequently enough
//!
//! ```rust
//! use iced::time;
//! fn subscription(state: &mut State) -> iced::Subscription<Message> {
//! time::every(std::time::Duration::from_millis(10))
//! .map(|_| iced_webview::Action::Update)
//! .map(Message::WebView)
//! }
//! # #[derive(Clone)]
//! # enum Message { WebView(iced_webview::Action) }
//! # struct State { webview: iced_webview::WebView<iced_webview::Ultralight, Message> }
//! ```
//!
//!
//! Examples can be found in the [iced_webview repo](https://github.com/LegitCamper/iced_webview)
//!
use image;
/// Engine Trait and Engine implementations
pub use ;
pub use ;
pub use ; // pub these since its the default/reccommended method
pub use Ultralight;
/// Image details for passing the view around