@@ -415,17 +415,17 @@ fn try_json_eq(expected: &str, actual: &str) -> Result<(), ProtocolTestFailure>
415415 }
416416}
417417
418- /// Compares two `ciborium::Value` instances for semantic equality.
418+ /// Compares two `ciborium::value:: Value` instances for semantic equality.
419419///
420420/// This function recursively compares two CBOR values, correctly handling arrays and maps
421421/// according to the CBOR specification. Arrays are compared element-wise in order,
422422/// while maps are compared without considering the order of key-value pairs.
423423fn cbor_values_equal (
424- a : & ciborium:: Value ,
425- b : & ciborium:: Value ,
424+ a : & ciborium:: value :: Value ,
425+ b : & ciborium:: value :: Value ,
426426) -> Result < bool , ProtocolTestFailure > {
427427 let result = match ( a, b) {
428- ( ciborium:: Value :: Array ( a_array) , ciborium:: Value :: Array ( b_array) ) => {
428+ ( ciborium:: value :: Value :: Array ( a_array) , ciborium:: value :: Value :: Array ( b_array) ) => {
429429 // Both arrays should be equal in size.
430430 a_array. len ( ) == b_array. len ( ) &&
431431 // Compare arrays element-wise.
@@ -434,9 +434,9 @@ fn cbor_values_equal(
434434 } ) ?
435435 }
436436
437- // Convert `ciborium::Value::Map` to a `HashMap`, and then compare the values of
437+ // Convert `ciborium::value:: Value::Map` to a `HashMap`, and then compare the values of
438438 // each key in `a` with those in `b`.
439- ( ciborium:: Value :: Map ( a_map) , ciborium:: Value :: Map ( b_map) ) => {
439+ ( ciborium:: value :: Value :: Map ( a_map) , ciborium:: value :: Value :: Map ( b_map) ) => {
440440 let a_hashmap = ciborium_map_to_hashmap ( a_map) ?;
441441 let b_hashmap = ciborium_map_to_hashmap ( b_map) ?;
442442
@@ -455,7 +455,7 @@ fn cbor_values_equal(
455455 }
456456 }
457457
458- ( ciborium:: Value :: Float ( a_float) , ciborium:: Value :: Float ( b_float) ) => {
458+ ( ciborium:: value :: Value :: Float ( a_float) , ciborium:: value :: Value :: Float ( b_float) ) => {
459459 a_float == b_float || a_float. is_nan ( ) && b_float. is_nan ( )
460460 }
461461
@@ -465,20 +465,20 @@ fn cbor_values_equal(
465465 Ok ( result)
466466}
467467
468- /// Converts a `ciborium::Value::Map` into a `HashMap<&String, &ciborium::Value>`.
468+ /// Converts a `ciborium::value:: Value::Map` into a `HashMap<&String, &ciborium::value ::Value>`.
469469///
470470/// CBOR maps (`Value::Map`) are internally represented as vectors of key-value pairs,
471471/// and direct comparison is affected by the order of these pairs.
472472/// Since the CBOR specification treats maps as unordered collections,
473473/// this function transforms the vector into a `HashMap`, for order-independent comparisons
474474/// between maps.
475475fn ciborium_map_to_hashmap (
476- cbor_map : & [ ( ciborium:: Value , ciborium:: Value ) ] ,
477- ) -> Result < std:: collections:: HashMap < & String , & ciborium:: Value > , ProtocolTestFailure > {
476+ cbor_map : & [ ( ciborium:: value :: Value , ciborium:: value :: Value ) ] ,
477+ ) -> Result < std:: collections:: HashMap < & String , & ciborium:: value :: Value > , ProtocolTestFailure > {
478478 cbor_map
479479 . iter ( )
480480 . map ( |( key, value) | match key {
481- ciborium:: Value :: Text ( key_str) => Ok ( ( key_str, value) ) ,
481+ ciborium:: value :: Value :: Text ( key_str) => Ok ( ( key_str, value) ) ,
482482 _ => Err ( ProtocolTestFailure :: InvalidBodyFormat {
483483 expected : "a text key as map entry" . to_string ( ) ,
484484 found : format ! ( "{:?}" , key) ,
@@ -494,14 +494,12 @@ fn try_cbor_eq<T: AsRef<[u8]> + Debug>(
494494 let decoded = base64_simd:: STANDARD
495495 . decode_to_vec ( expected_body)
496496 . expect ( "smithy protocol test `body` property is not properly base64 encoded" ) ;
497- let expected_cbor_value: ciborium:: Value =
498- ciborium:: from_reader ( decoded. as_slice ( ) ) . expect ( "expected value must be valid CBOR" ) ;
499- let actual_cbor_value: ciborium:: Value =
500- ciborium:: from_reader ( actual_body. as_ref ( ) ) . map_err ( |e| {
501- ProtocolTestFailure :: InvalidBodyFormat {
502- expected : "cbor" . to_owned ( ) ,
503- found : format ! ( "{} {:?}" , e, actual_body) ,
504- }
497+ let expected_cbor_value: ciborium:: value:: Value =
498+ ciborium:: de:: from_reader ( decoded. as_slice ( ) ) . expect ( "expected value must be valid CBOR" ) ;
499+ let actual_cbor_value: ciborium:: value:: Value = ciborium:: de:: from_reader ( actual_body. as_ref ( ) )
500+ . map_err ( |e| ProtocolTestFailure :: InvalidBodyFormat {
501+ expected : "cbor" . to_owned ( ) ,
502+ found : format ! ( "{} {:?}" , e, actual_body) ,
505503 } ) ?;
506504 let actual_body_base64 = base64_simd:: STANDARD . encode_to_string ( & actual_body) ;
507505
0 commit comments