Comments (4)
Thanks for the suggestion! I think it makes sense to do something like that however:
- I won't have time to work on it before mid June.
- I'm not sure it will be possible to have those functions const. If not I'll expose them in data-encoding-macro. Or if possible in nightly I'll add a feature.
I'll come back to this later.
from data-encoding.
As expected, making {encode,decode}_len
const fns does not work for a few different reasons:
- I use traits and it's not possible to have
const fn
in traits. - I use
Cow
(when thealloc
feature is enabled) and rely onDeref
which is not const.
So I'll go with the solution of making those functions macros in the data-encoding-macro
crate. I'll only have time to look at this at the earliest this week-end though. I'll ping here when done.
from data-encoding.
You can test if #70 is fixing your issue. Instead of writing let buf = [0u8; BASE64.encode_len(32)];
as in your original comment, you would need to write let buf = [0u8; base64_encode_len!(32)];
instead. If that's useful, I'll merge and make a release.
from data-encoding.
Related Issues (20)
- Do not use deprecated proc-macro-hack
- no-std support for macro crate
- Macros Won't Build in no_std HOT 4
- (std -> core)::fmt::Display for DecodeError and DecodeKind HOT 2
- 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
- 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
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.