aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2021-10-07 22:25:14 +0200
committerDaniel Schadt <kingdread@gmx.de>2021-10-07 22:25:14 +0200
commit048e05b9d46bb33b45f8a31b9ec079aae7dd1cf1 (patch)
treee8a3ba940dcca6f0eb45109b7e5d08ea700310ed
parent4327d932613b329e6e3b33d78f55662127bd4203 (diff)
downloadkondou-048e05b9d46bb33b45f8a31b9ec079aae7dd1cf1.tar.gz
kondou-048e05b9d46bb33b45f8a31b9ec079aae7dd1cf1.tar.bz2
kondou-048e05b9d46bb33b45f8a31b9ec079aae7dd1cf1.zip
Update dependencies
Some slight API changes in rusttype, but apart from that it's only version number bumps.
-rw-r--r--Cargo.toml12
-rw-r--r--src/render.rs4
-rw-r--r--src/useropts.rs9
3 files changed, 12 insertions, 13 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 3b37d1f..ec6cf67 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,18 +8,18 @@ edition = "2018"
[dependencies]
image = "0.23"
-imageproc = "0.20"
-rusttype = "0.8"
-reqwest = { version = "0.10", features = ["default-tls", "blocking", "json"] }
+imageproc = "0.22.0"
+rusttype = "0.9.2"
+reqwest = { version = "0.11.5", features = ["default-tls", "blocking", "json"] }
serde = { version = "1.0", features = ["std", "derive"] }
serde_json = "1.0"
clap = "2.33"
xdg = "2.2.0"
-itertools = "0.9.0"
+itertools = "0.10.1"
md5 = "0.7"
-base64 = "0.12"
+base64 = "0.13.0"
termcolor = "1.0"
-num_enum = "0.4"
+num_enum = "0.5.4"
num-traits = "0.2"
byteorder = "1.3"
toml = "0.5"
diff --git a/src/render.rs b/src/render.rs
index cb6a4fb..fa8e1df 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -6,7 +6,7 @@ use image::{
};
use imageproc::{drawing, rect::Rect};
use num_traits::{Num, NumCast};
-use rusttype::{Font, Scale, SharedBytes};
+use rusttype::{Font, Scale};
use serde::{Deserialize, Serialize};
use std::{error::Error, fmt};
@@ -86,7 +86,7 @@ impl Default for RenderOptions {
trait_size: 30,
line_color: Rgba([0, 0, 0, 255]),
line_height: 4,
- font: Font::from_bytes(SharedBytes::ByRef(include_bytes!("LiberationMono.ttf")))
+ font: Font::try_from_bytes(include_bytes!("LiberationMono.ttf"))
.expect("Invalid font data for default font"),
text_color: Rgba([0, 0, 0, 255]),
text_size: 20,
diff --git a/src/useropts.rs b/src/useropts.rs
index b342839..27e14df 100644
--- a/src/useropts.rs
+++ b/src/useropts.rs
@@ -20,14 +20,13 @@ use super::render::{Alignment, RenderOptions};
pub enum ConfigError {
Io(io::Error),
Serialization(toml::de::Error),
- Font(rusttype::Error),
+ Font,
}
error_froms! {
ConfigError,
err: io::Error => ConfigError::Io(err),
err: toml::de::Error => ConfigError::Serialization(err),
- err: rusttype::Error => ConfigError::Font(err),
}
impl fmt::Display for ConfigError {
@@ -36,7 +35,7 @@ impl fmt::Display for ConfigError {
match *self {
ConfigError::Io(_) => write!(f, "input/output error"),
ConfigError::Serialization(_) => write!(f, "serialization error"),
- ConfigError::Font(_) => write!(f, "could not load the font"),
+ ConfigError::Font => write!(f, "could not load the font"),
}
}
}
@@ -46,7 +45,7 @@ impl Error for ConfigError {
match *self {
ConfigError::Io(ref err) => Some(err),
ConfigError::Serialization(ref err) => Some(err),
- ConfigError::Font(ref err) => Some(err),
+ ConfigError::Font => None,
}
}
}
@@ -109,7 +108,7 @@ impl UserOptions {
if let Some(path) = self.font_path {
let data = fs::read(path)?;
- let font = Font::from_bytes(data)?;
+ let font = Font::try_from_vec(data).ok_or(ConfigError::Font)?;
result.font = font;
}