Send + Sync

This commit is contained in:
Sam Denty 2022-05-03 23:35:09 +01:00
parent e7f181cd5f
commit e82dce00c0
No known key found for this signature in database
GPG key ID: 7B4EAF7B9E291B79
9 changed files with 12 additions and 12 deletions

6
Cargo.lock generated
View file

@ -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",

View file

@ -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"

View file

@ -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() {

View file

@ -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?;

View file

@ -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);

View file

@ -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)?;

View file

@ -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);

View file

@ -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 }),

View file

@ -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.
//!