Comments (6)
Hi, you should be able to use this function depending on your use-case. Could you tell me a bit more if that function doesn't satisfy your need? Thanks!
from data-encoding.
Sorry for not being clear enough: I am wondering if there is a way to write into a &mut String without allocating an intermediary String. Thanks.
from data-encoding.
I see, indeed this is a missing feature. If I understand correctly, you are suggesting adding something like:
/// Appends the encoding of `input` to `output`
pub fn encode_mut_string(&self, input: &[u8], output: &mut String)
This looks like a useful function. I will need to think a bit about the naming and see if I don't merge it with encode_mut
using a trait for the supported output types.
When would you need such function?
In the meantime, I guess you already use something similar to this as a workaround.
from data-encoding.
I am building a String which I then use elsewhere. I could make it a Vec instead, but that would mean I have to check that it's correct UTF-8 later, OR I could just use your workaround (which I am not using, so thanks!). Thanks for the help, it's a really nice crate.
from data-encoding.
No problem, thanks! I'll take a look at it when I get time.
Indeed, users should not have to use Vec instead of String for output of encoding functions. In particular, data-encoding
provides the guarantee that output is ASCII, so the unsafe code should be hidden in the library so that users can use a safe API.
from data-encoding.
data-encoding 2.3.0
has been released and provides an encode_append
function as requested. If anything is wrong, please reopen the issue. Thanks for the initial feedback!
from data-encoding.
Related Issues (20)
- Consider `check_trailing_bits=false` for BASE64_MIME decoder HOT 1
- Release 3.0.0
- Support Nix base32 HOT 1
- feature `std` leaking when using macro in no_std env HOT 7
- Missing a new line and decode error HOT 2
- Rust 2021 edition is a major, not a "patch" change HOT 6
- Removing dependency on syn HOT 7
- Make `{encode,decode}_len` const fns? HOT 4
- Encode into an "impl std::fmt::Write" and/or "impl std::io::Write" HOT 5
- Breaking change wish list
- Use doc_auto_cfg once stable HOT 2
- Use as_chunks family of functions once stable
- Internal symbols array is publicly exposed and unsound HOT 4
- Deny warnings in rustdoc
- Partial encoding with padding HOT 3
- Question about Specification HOT 6
- Release 2.5.0
- SIMD optimization HOT 4
- `Encoding::encode_mut` is very code-size heavy HOT 15
- feature request - base58 d/encoding HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data-encoding.