Skip to content
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

Add emit_binary() to serialize::Encoder trait #12293

Closed
mneumann opened this issue Feb 15, 2014 · 1 comment
Closed

Add emit_binary() to serialize::Encoder trait #12293

mneumann opened this issue Feb 15, 2014 · 1 comment

Comments

@mneumann
Copy link
Contributor

My proposal is to extend trait serialize::Encoder with:

pub trait Encoder {
    fn emit_binary(&mut self, bin: &[u8]);
}

Which special cases emit_seq for u8's. Msgpack for example support both binaries and sequences of values, while sequences of values incur more overhead because it needs to encode the elements type for each element.

Right now it is not possible to efficiently emit binary type, like type bin = ~[u8] using the Encoder trait. With this change it would be possible. Orthogonally a read_binary() should be added to the Decoder trait, but it is not that important, as read_seq can be overloaded accordingly to read both binaries or sequences.

The default behaviour of emit_binary() could be made to emit a sequence, so almost no code need to be changed.

@steveklabnik
Copy link
Member

The serialize crate is now out of tree.

bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
…p, r=jonas-schievink

fix: calculate correct postion for Dos line ending in mapping rustc range to ls…

fix rust-lang#12293
flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 26, 2024
[`case_sensitive_file_extension_comparisons`]: Don't trigger on digits-only extensions

If we find a file extension check with only digits (`.123`), do not trigger `case_sensitive_file_extension_comparisons`.

Fixes rust-lang#12252

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`case_sensitive_file_extension_comparisons`]: Don't trigger on digits-only extensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants