#![allow(missing_docs)] use crate::runtime::futures; use iced_program as program; use iced_widget::core; use iced_widget::runtime; use crate::core::Element; use crate::core::theme; use crate::core::window; use crate::futures::Subscription; use crate::program::Program; use crate::runtime::Task; use std::fmt; pub fn attach(program: impl Program + 'static) -> impl Program { struct Attach
{ program: P, } impl
Program for Attach
where P: Program + 'static, { type State = DevTools
; type Message = Message
;
type Theme = P::Theme;
type Renderer = P::Renderer;
type Executor = P::Executor;
fn name() -> &'static str {
P::name()
}
fn boot(&self) -> (Self::State, Task
where
P: Program,
{
state: P::State,
}
impl DevTools
where
P: Program + 'static,
{
pub fn title(&self, program: &P, window: window::Id) -> String {
program.title(&self.state, window)
}
pub fn update(
&mut self,
program: &P,
message: Message ,
) -> Task , P::Theme, P::Renderer> {
program.view(&self.state, window).map(Message::Program)
}
pub fn subscription(&self, program: &P) -> Subscription
where
P: Program,
{
Program(P::Message),
}
impl fmt::Debug for Message
where
P: Program,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Message::Program(message) => message.fmt(f),
}
}
}