Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies #14

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust_version: [1.56, stable]
rust_version: [1.62.0, stable]
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
Expand Down
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ keywords = ["kdl", "configuration", "parser"]
categories = ["parser-implementations", "config", "encoding"]
homepage = "https://github.com/tailhook/knuffel"
documentation = "https://docs.rs/knuffel"
rust-version = "1.56.0"
rust-version = "1.62.0"
readme = "README.md"

[dependencies]
chumsky = {version="0.8.0", default-features=false}
knuffel-derive = {path="./derive", version= "^2.0.0", optional=true}
base64 = {version="0.13.0", optional=true}
unicode-width = {version="0.1.9", optional=true}
minicbor = {version="0.13.2", optional=true, features=["std", "derive"]}
miette = "4.3.0"
chumsky = { version = "0.8.0", default-features = false }
knuffel-derive = { path = "./derive", version = "^2.0.0", optional = true }
base64 = { version = "0.21.0", optional = true }
unicode-width = { version = "0.1.9", optional = true }
minicbor = { version = "0.19.0", optional = true, features = ["std", "derive"] }
miette = "5.0.0"
thiserror = "1.0.30"

[dev-dependencies]
miette = { version="4.3.0", features=["fancy"] }
miette = { version = "5.0.0", features = ["fancy"] }
assert-json-diff = "2.0.1"
serde_json = "1.0"

Expand Down
6 changes: 3 additions & 3 deletions derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ proc_macro = true

[dependencies]
heck = "0.4.0"
syn = {version="1.0.81", features=["full", "extra-traits"]}
syn = { version = "1.0.81", features = ["full", "extra-traits"] }
quote = "1.0.10"
proc-macro2 = "1.0.32"
proc-macro-error = "1.0.4"

[dev-dependencies]
knuffel = { path=".." }
miette = { version="4.3.0", features=["fancy"] }
knuffel = { path = ".." }
miette = { version = "5.0.0", features = ["fancy"] }
6 changes: 3 additions & 3 deletions derive/tests/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,12 @@ fn parse_str() {
assert_eq!(parse_doc::<Parse>(r#"listen "127.0.0.1:8080""#),
Parse { listen: "127.0.0.1:8080".parse().unwrap() });
assert_eq!(parse_doc_err::<Parse>(r#"listen "2/3""#),
"invalid IP address syntax");
"invalid socket address syntax");

assert_eq!(parse::<ParseOpt>(r#"server listen="127.0.0.1:8080""#),
ParseOpt { listen: Some("127.0.0.1:8080".parse().unwrap()) });
assert_eq!(parse_err::<ParseOpt>(r#"server listen="2/3""#),
"invalid IP address syntax");
"invalid socket address syntax");
assert_eq!(parse::<ParseOpt>(r#"server listen=null"#),
ParseOpt { listen: None });
}
Expand All @@ -559,7 +559,7 @@ fn parse_bytes() {
assert_eq!(parse_doc::<Bytes>(r#"data "world""#),
Bytes { data: b"world".to_vec() });
assert_eq!(parse_doc_err::<Bytes>(r#"data (base64)"2/3""#),
"Invalid last symbol 51, offset 2.");
"Invalid padding");

assert_eq!(parse::<OptBytes>(r#"node data=(base64)"aGVsbG8=""#),
OptBytes { data: Some(b"hello".to_vec()) });
Expand Down
10 changes: 5 additions & 5 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,19 +293,19 @@ mod cbor {
use minicbor::encode::Encode;
use minicbor::decode::Decode;

impl<'d> Decode<'d> for TypeName {
fn decode(d: &mut Decoder<'d>)
impl<'d, C> Decode<'d, C> for TypeName {
fn decode(d: &mut Decoder<'d>, _: &mut C)
-> Result<Self, minicbor::decode::Error>
{
d.str().and_then(|s| s.parse().map_err(|e| match e {}))
}
}
impl Encode for TypeName {
fn encode<W>(&self, e: &mut Encoder<W>)
impl<C> Encode<C> for TypeName {
fn encode<W>(&self, e: &mut Encoder<W>, ctx: &mut C)
-> Result<(), minicbor::encode::Error<W::Error>>
where W: minicbor::encode::write::Write
{
self.as_str().encode(e)
self.as_str().encode(e, ctx)
}
}
}
5 changes: 4 additions & 1 deletion src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use std::collections::HashMap;
use std::default::Default;
use std::fmt;

#[cfg(feature="base64")]
use base64::{Engine as _, engine::general_purpose::STANDARD};

use crate::ast::{Literal, BuiltinType, Value, SpannedNode};
use crate::errors::{DecodeError, ExpectedType};
use crate::traits::{ErrorSpan, Decode};
Expand Down Expand Up @@ -53,7 +56,7 @@ pub fn bytes<S: ErrorSpan>(value: &Value<S>, ctx: &mut Context<S>) -> Vec<u8> {
#[cfg(feature="base64")] {
match &*value.literal {
Literal::String(s) => {
match base64::decode(s.as_bytes()) {
match STANDARD.decode(s.as_bytes()) {
Ok(vec) => vec,
Err(e) => {
ctx.emit_error(DecodeError::conversion(
Expand Down