Skip to content
Merged
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 deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ allow = [
"Apache-2.0",
"ISC",
"OpenSSL",
"Unicode-DFS-2016",
"Unicode-3.0",
#"Apache-2.0 WITH LLVM-exception",
# Considered Copyleft, but permitted in this project
"MPL-2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<'de> Deserialize<'de> for Bytes {

struct BytesVisitor;

impl<'de> Visitor<'de> for BytesVisitor {
impl Visitor<'_> for BytesVisitor {
type Value = Bytes;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
9 changes: 5 additions & 4 deletions src/ear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ fn alg_to_cose(alg: &Algorithm) -> Result<i32, Error> {
mod test {
use super::*;
use crate::extension::*;
use crate::raw::{RawValue, RawValueKind};
use ciborium::{de::from_reader, ser::into_writer};

const EAR_STRING: &str = r#"
Expand Down Expand Up @@ -805,20 +806,20 @@ MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgPp4XZRnRHSMhGg0t
fn serde_extensions() {
let mut profile = Profile::new("tag:github.com,2023:veraison/ear");
profile
.register_ear_extension("ext1", -1, ExtensionKind::String)
.register_ear_extension("ext1", -1, RawValueKind::String)
.unwrap();
profile
.register_ear_extension("ext2", -2, ExtensionKind::Integer)
.register_ear_extension("ext2", -2, RawValueKind::Integer)
.unwrap();
profile
.register_appraisal_extension("ext3", -1, ExtensionKind::Bytes)
.register_appraisal_extension("ext3", -1, RawValueKind::Bytes)
.unwrap();
register_profile(&profile).unwrap();

let ear = serde_json::from_str::<Ear>(EAR_WITH_EXTENSIONS_STRING).unwrap();

let v1 = ear.extensions.get_by_name("ext1").unwrap();
assert_eq!(v1, ExtensionValue::String("foo".to_string()));
assert_eq!(v1, RawValue::String("foo".to_string()));

let text = serde_json::to_string(&ear).unwrap();
assert_eq!(
Expand Down
3 changes: 3 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ pub enum Error {
// error while registering or accessing profiles
#[error("profile error: {0}")]
ProfileError(String),
// error during value conversion
#[error("value error: {0}")]
ValueError(String),
}
Loading
Loading