Use new async || closure syntax 🎉
This commit is contained in:
parent
0f9934b1a7
commit
800a73ddd7
3 changed files with 3 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ use iced::task::{Straw, sipper};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub fn download(url: impl AsRef<str>) -> impl Straw<(), Progress, Error> {
|
pub fn download(url: impl AsRef<str>) -> impl Straw<(), Progress, Error> {
|
||||||
sipper(move |mut progress| async move {
|
sipper(async move |mut progress| {
|
||||||
let response = reqwest::get(url.as_ref()).await?;
|
let response = reqwest::get(url.as_ref()).await?;
|
||||||
let total = response.content_length().ok_or(Error::NoContentLength)?;
|
let total = response.content_length().ok_or(Error::NoContentLength)?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ impl Image {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn download(self, size: Size) -> impl Straw<Rgba, Blurhash, Error> {
|
pub fn download(self, size: Size) -> impl Straw<Rgba, Blurhash, Error> {
|
||||||
sipper(move |mut sender| async move {
|
sipper(async move |mut sender| {
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
if let Size::Thumbnail { width, height } = size {
|
if let Size::Thumbnail { width, height } = size {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use async_tungstenite::tungstenite;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
pub fn connect() -> impl Sipper<Never, Event> {
|
pub fn connect() -> impl Sipper<Never, Event> {
|
||||||
sipper(|mut output| async move {
|
sipper(async |mut output| {
|
||||||
loop {
|
loop {
|
||||||
const ECHO_SERVER: &str = "ws://127.0.0.1:3030";
|
const ECHO_SERVER: &str = "ws://127.0.0.1:3030";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue