PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: pyfisch/cbor (rust)

Issue:
Override `is_human_readable`
According to the docs when [`is_human_readable`](https://docs.rs/serde/1.0.23/serde/trait.Serializer.html#method.is_human_readable) is `false` serializer can produce more compact and efficient form. I think this is what expected from cbor serializer. (default is `true`)

Unfortunately changing it is a breaking change, but I think it's okay in zero-point release.

So I'll make a PR, if you're fine with it?

Alternative would be to make it configurable, but I don't think human-readable things in binary cbor is a good default.

Pull request:
Set Serializer is_human_readable to false.
Closes #51

BREAKING CHANGE: This results in a different serialization
for common types e.g. Ipv4Addr.

Patch:
diff --git a/src/ser.rs b/src/ser.rs
index 8599893..f0d524e 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -453,6 +453,10 @@ where
         self.serialize_unit_variant(name, variant_index, variant)?;
         self.serialize_struct(name, len)
     }
+
+    fn is_human_readable(&self) -> bool {
+        false
+    }
 }
 
 impl<'a, W> ser::SerializeTuple for &'a mut Serializer<W>


Test patch:
diff --git a/tests/ser.rs b/tests/ser.rs
index 85daf16..a30c9a5 100644
--- a/tests/ser.rs
+++ b/tests/ser.rs
@@ -91,3 +91,13 @@ fn test_self_describing() {
     }
     assert_eq!(vec, b"\xd9\xd9\xf7\x09");
 }
+
+#[test]
+fn test_ip_addr() {
+    use std::net::Ipv4Addr;
+
+    let addr = Ipv4Addr::new(8, 8, 8, 8);
+    let vec = to_vec(&addr).unwrap();
+    println!("{:?}", vec);
+    assert_eq!(vec.len(), 5);
+}