-
Notifications
You must be signed in to change notification settings - Fork 65
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
[Bug]: v0.2.1 API is incompatible with v0.2.0 API #79
Comments
This bug impacts me and I stumbled upon this issue. In case it helps, here's a simple example to reproduce. This compiles on use std::borrow::Cow;
fn main() {
#[derive(serde::Deserialize, serde::Serialize, Debug, PartialEq)]
pub struct MyMessage<'a> {
#[serde(borrow)]
pub value: Cow<'a, str>,
}
let string: String = "hello world!".to_string();
let my_message = MyMessage {
value: Cow::Borrowed(&string),
};
let mut cbor = Vec::new();
ciborium::ser::into_writer(&my_message, &mut cbor).unwrap();
let decoded = ciborium::de::from_reader(cbor.as_slice()).unwrap();
assert_eq!(my_message, decoded);
}
|
Ah, I see. So Regardless of this issue and the #45 issue, I think it's important to call out the "no-borrowing" limitation of this crate early in the docs. Many other serde implementations do support zero-copy |
I'm not asking anyone to do any work here, but would y'all consider a |
PRs welcome! Would this be an additional function? We're happy to accept changes which make this crate more useful, we aren't set on doing things in a specific way, I don't think. |
I believe that that would be required given the current dependence on the |
Is there an existing issue for this?
Code of Conduct
Current Behaviour
In v0.2.1 the signature of
ciborium::de::from_reader()
changed fromto
At first sight the new bound appears to be a looser bound than the original one, because in the
serde
crate we haveso apparently anything that implements
Deserialize
also implementsDeserializeOwned
.That is not a correct interpretation of the above blanket implementation, however, because it actually says that only types that implement
Deserialize<'de>
for any lifetime'de
also implementDeserializeOwned
. Hence the signature change ofciborium::de::from_reader()
is not a bound loosening and should therefore be considered a major change according to SemVer.All this is to say that I think v0.2.1 should have actually gotten the version number 0.3.0.
Expected Behaviour
The signature change of
ciborium::de::from_reader()
is released under a new major version of the crate.Environment Information
/
Steps To Reproduce
No response
The text was updated successfully, but these errors were encountered: