mirror of
https://github.com/Death916/deathclock.git
synced 2026-04-10 03:04:40 -07:00
cargo fmt
This commit is contained in:
parent
16e5bf3d5f
commit
008dbe785d
5 changed files with 15 additions and 15 deletions
|
|
@ -20,7 +20,12 @@ const WEATHER_UPDATE_TIME_MINS: u64 = 30;
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
iced::application(
|
iced::application(
|
||||||
|| (RustClock::default(), Task::perform(weather::get_weather(), Message::UpdateWeatherImg)), // Wrap it in a closure
|
|| {
|
||||||
|
(
|
||||||
|
RustClock::default(),
|
||||||
|
Task::perform(weather::get_weather(), Message::UpdateWeatherImg),
|
||||||
|
)
|
||||||
|
}, // Wrap it in a closure
|
||||||
RustClock::update,
|
RustClock::update,
|
||||||
RustClock::view,
|
RustClock::view,
|
||||||
)
|
)
|
||||||
|
|
@ -70,7 +75,7 @@ impl RustClock {
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
Message::PaneDragged(_) => Task::none(),
|
Message::PaneDragged(_) => Task::none(),
|
||||||
|
|
||||||
Message::PaneResized(pane_grid::ResizeEvent { split, ratio }) => {
|
Message::PaneResized(pane_grid::ResizeEvent { split, ratio }) => {
|
||||||
self.panes.resize(split, ratio);
|
self.panes.resize(split, ratio);
|
||||||
Task::none()
|
Task::none()
|
||||||
|
|
@ -138,7 +143,6 @@ impl Default for RustClock {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(k, v)| (k, Handle::from_bytes(v)))
|
.map(|(k, v)| (k, Handle::from_bytes(v)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|
||||||
RustClock {
|
RustClock {
|
||||||
current_time: Local::now(),
|
current_time: Local::now(),
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ use rss::Channel;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
|
|
||||||
|
|
||||||
pub async fn get_news() -> Vec<Channel> {
|
pub async fn get_news() -> Vec<Channel> {
|
||||||
let feeds = File::open("../feeds.txt");
|
let feeds = File::open("../feeds.txt");
|
||||||
let mut feed_vec = Vec::new();
|
let mut feed_vec = Vec::new();
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@ use chrono::Local;
|
||||||
use iced::Border;
|
use iced::Border;
|
||||||
use iced::Element;
|
use iced::Element;
|
||||||
use iced::Fill;
|
use iced::Fill;
|
||||||
|
use iced::widget::scrollable::{Direction, Scrollbar};
|
||||||
use iced::widget::{column, container, image, row, scrollable, text};
|
use iced::widget::{column, container, image, row, scrollable, text};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use iced::widget::scrollable::{Direction, Scrollbar};
|
|
||||||
|
|
||||||
|
|
||||||
use crate::Message;
|
use crate::Message;
|
||||||
use crate::sports::Game;
|
use crate::sports::Game;
|
||||||
|
|
@ -121,7 +120,7 @@ pub fn render_mlb_pane<'a>(
|
||||||
})
|
})
|
||||||
.into()
|
.into()
|
||||||
})))
|
})))
|
||||||
.direction(Direction::Vertical(Scrollbar::hidden()))
|
.direction(Direction::Vertical(Scrollbar::hidden()))
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,4 +154,3 @@ pub fn render_weather_pane<'a>(
|
||||||
.center_y(Fill)
|
.center_y(Fill)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -212,4 +212,4 @@ mod tests {
|
||||||
let mlb_scores = update_mlb();
|
let mlb_scores = update_mlb();
|
||||||
assert!(!mlb_scores.is_empty());
|
assert!(!mlb_scores.is_empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,8 @@ pub async fn get_weather() -> Handle {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
||||||
async fn test_get_weather() {
|
async fn test_get_weather() {
|
||||||
let handle = get_weather().await;
|
let handle = get_weather().await;
|
||||||
let handle_type: Handle = handle.clone();
|
let handle_type: Handle = handle.clone();
|
||||||
assert_eq!(handle_type, handle);
|
assert_eq!(handle_type, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue