Send + Sync
This commit is contained in:
parent
e7f181cd5f
commit
e82dce00c0
9 changed files with 12 additions and 12 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -295,9 +295,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.8.4"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
|
||||
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"humantime",
|
||||
|
@ -1494,7 +1494,7 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
|||
|
||||
[[package]]
|
||||
name = "site_icons"
|
||||
version = "0.1.7"
|
||||
version = "0.1.9"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"clap",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "site_icons"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
authors = ["Sam Denty <sam@samdenty.com>"]
|
||||
edition = "2018"
|
||||
license = "GPL-3.0"
|
||||
|
|
|
@ -30,7 +30,7 @@ pub enum IconInfo {
|
|||
}
|
||||
|
||||
impl IconInfo {
|
||||
pub async fn load(url: Url, sizes: Option<String>) -> Result<IconInfo, Box<dyn Error>> {
|
||||
pub async fn load(url: Url, sizes: Option<String>) -> Result<IconInfo, Box<dyn Error + Send + Sync>> {
|
||||
let sizes = sizes.as_ref().and_then(|s| IconSizes::from_str(s).ok());
|
||||
|
||||
let (mime, mut body): (_, Box<dyn AsyncRead + Unpin>) = match url.scheme() {
|
||||
|
|
|
@ -12,7 +12,7 @@ const INDEX_SIZE: u16 = 16;
|
|||
|
||||
pub async fn get_ico_sizes<R: AsyncRead + Unpin>(
|
||||
reader: &mut R,
|
||||
) -> Result<IconSizes, Box<dyn Error>> {
|
||||
) -> Result<IconSizes, Box<dyn Error + Send + Sync>> {
|
||||
let mut offset = 0;
|
||||
let mut header = [0; 6];
|
||||
reader.read_exact(&mut header).await?;
|
||||
|
|
|
@ -6,7 +6,7 @@ use tokio_futures_byteorder::AsyncReadBytesExt;
|
|||
|
||||
pub async fn get_jpeg_size<R: AsyncRead + Unpin>(
|
||||
reader: &mut R,
|
||||
) -> Result<IconSize, Box<dyn Error>> {
|
||||
) -> Result<IconSize, Box<dyn Error + Send + Sync>> {
|
||||
let mut data = [0; 2];
|
||||
reader.read_exact(&mut data).await?;
|
||||
let data = &mut Cursor::new(data);
|
||||
|
|
|
@ -88,7 +88,7 @@ fn slice_eq<T: Read + Seek + Unpin>(
|
|||
cur: &mut T,
|
||||
offset: u64,
|
||||
slice: &[u8],
|
||||
) -> Result<bool, Box<dyn Error>> {
|
||||
) -> Result<bool, Box<dyn Error + Send + Sync>> {
|
||||
cur.seek(SeekFrom::Start(offset))?;
|
||||
let mut buffer = vec![0; slice.len()];
|
||||
cur.read_exact(&mut buffer)?;
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{error::Error, io::Cursor};
|
|||
|
||||
pub async fn get_png_sizes<R: AsyncRead + Unpin>(
|
||||
reader: &mut R,
|
||||
) -> Result<IconSize, Box<dyn Error>> {
|
||||
) -> Result<IconSize, Box<dyn Error + Send + Sync>> {
|
||||
let mut header = [0; 24];
|
||||
reader.read_exact(&mut header).await?;
|
||||
let header = &mut Cursor::new(header);
|
||||
|
|
|
@ -19,7 +19,7 @@ pub struct Icons {
|
|||
Url,
|
||||
(
|
||||
IconKind,
|
||||
Pin<Box<dyn Future<Output = Result<IconInfo, Box<dyn Error>>>>>,
|
||||
Pin<Box<dyn Future<Output = Result<IconInfo, Box<dyn Error + Send + Sync>>>>>,
|
||||
),
|
||||
>,
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ fn add_icon_entry(
|
|||
entries: &mut Vec<Icon>,
|
||||
url: Url,
|
||||
kind: IconKind,
|
||||
info: Result<IconInfo, Box<dyn Error>>,
|
||||
info: Result<IconInfo, Box<dyn Error + Send + Sync>>,
|
||||
) {
|
||||
match info {
|
||||
Ok(info) => entries.push(Icon { url, kind, info }),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![feature(async_closure, map_into_keys_values, bool_to_option)]
|
||||
#![feature(async_closure, bool_to_option)]
|
||||
//! # site_icons
|
||||
//! An efficient website icon scraper.
|
||||
//!
|
||||
|
|
Reference in a new issue