Skip to content

Commit 1910c54

Browse files
fixed a test
1 parent 2f46e35 commit 1910c54

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

amqp-lib/src/types/amqp_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ mod tests {
642642
arr.push("aaaaaaaaaaaaaaaaaaaa".into());
643643
}
644644
let val = AmqpType::Array(arr.into());
645-
assert_eq!(val.encode().constructor(), 0xe0);
645+
assert_eq!(val.encode().constructor(), 0xf0);
646646

647647
}
648648
}

amqp-lib/src/types/binary.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ pub struct Binary(Vec<u8>);
77

88
impl Encode for Binary {
99
fn encode(&self) -> Encoded {
10-
todo!()
10+
match self.0.len() {
11+
x if x <= 255 => Encoded::new(0xa0, Some(self.0.to_owned())),
12+
_ => Encoded::new(0xb0, Some(self.0.to_owned()))
13+
}
1114
}
1215
}
1316

amqp-lib/src/types/collection.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::types::amqp_type::{AmqpType, Constructor, Encode};
22
use indexmap::IndexMap;
3+
use tracing::info;
34
use std::hash::Hash;
45

56
use super::amqp_type::Encoded;

0 commit comments

Comments
 (0)