Make methods of DevTools public

Co-authored-by: ShootingStarDragons <ShootingStarDragons@protonmail.com>
This commit is contained in:
Héctor Ramón Jiménez 2025-06-05 00:35:53 +02:00
parent 1fd6980f91
commit 9cf9790198
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -165,7 +165,7 @@ impl<P> DevTools<P>
where where
P: Program + 'static, P: Program + 'static,
{ {
fn new(state: P::State) -> (Self, Task<Message>) { pub fn new(state: P::State) -> (Self, Task<Message>) {
( (
Self { Self {
state, state,
@ -181,11 +181,11 @@ where
) )
} }
fn title(&self, program: &P, window: window::Id) -> String { pub fn title(&self, program: &P, window: window::Id) -> String {
program.title(&self.state, window) program.title(&self.state, window)
} }
fn update(&mut self, program: &P, event: Event<P>) -> Task<Event<P>> { pub fn update(&mut self, program: &P, event: Event<P>) -> Task<Event<P>> {
match event { match event {
Event::Message(message) => match message { Event::Message(message) => match message {
Message::HideNotification => { Message::HideNotification => {
@ -339,7 +339,7 @@ where
} }
} }
fn view( pub fn view(
&self, &self,
program: &P, program: &P,
window: window::Id, window: window::Id,
@ -434,7 +434,7 @@ where
.into() .into()
} }
fn subscription(&self, program: &P) -> Subscription<Event<P>> { pub fn subscription(&self, program: &P) -> Subscription<Event<P>> {
let subscription = match &self.mode { let subscription = match &self.mode {
Mode::Open { tester } if !tester.is_idle() => { Mode::Open { tester } if !tester.is_idle() => {
tester.subscription(program).map(Event::Tester) tester.subscription(program).map(Event::Tester)
@ -471,15 +471,15 @@ where
Subscription::batch([subscription, hotkeys, commands]) Subscription::batch([subscription, hotkeys, commands])
} }
fn theme(&self, program: &P, window: window::Id) -> P::Theme { pub fn theme(&self, program: &P, window: window::Id) -> P::Theme {
program.theme(self.state(), window) program.theme(self.state(), window)
} }
fn style(&self, program: &P, theme: &P::Theme) -> theme::Style { pub fn style(&self, program: &P, theme: &P::Theme) -> theme::Style {
program.style(self.state(), theme) program.style(self.state(), theme)
} }
fn scale_factor(&self, program: &P, window: window::Id) -> f64 { pub fn scale_factor(&self, program: &P, window: window::Id) -> f64 {
if let Mode::Open { .. } = &self.mode { if let Mode::Open { .. } = &self.mode {
1.0 1.0
} else { } else {
@ -487,7 +487,7 @@ where
} }
} }
fn state(&self) -> &P::State { pub fn state(&self) -> &P::State {
self.time_machine.state().unwrap_or(&self.state) self.time_machine.state().unwrap_or(&self.state)
} }
} }