Comments (2)
I wasn't able to generate const fn
getters because the getter call a method from the (internal) BitRange
trait which is not const
. I tried to make it const
but it seems to not be possible to make a method from a trait const
(see rustc --explain E0379
).
If you find a satisfying workaround that doesn't imply getting rid of the trait, I would be happy to implement it.
from rust-bitfield.
I read up on that explanation and the linked RFC. Looks like const traits aren't a thing (yet?). All I can think of to do is to generate your current BitRange
implementations as loose pub const fn
s, generate the BitRange
implementations to use those, and have the exposed macro's of bitfield use the const
version so they can be const
themselves. Then the users of the crate can choose between the const
functions and the more convenient trait
abstraction.
from rust-bitfield.
Related Issues (20)
- bitfield should create constructor methods HOT 3
- Use the :vis fragment specifier HOT 3
- `into` should affect the setter
- Make getters work with immutable Data HOT 1
- About endianness HOT 2
- Please document the `index: usize` and `value: $from` arguments that getters and setters require HOT 4
- Unable to "Debug" for types that are backed by an array >32bytes HOT 5
- Requires AsMut and AsRef with buffers > 32 bytes HOT 2
- feature: API to set a range of bits using offset and length HOT 3
- Trying to use it for my library but cannot compile. HOT 2
- How to properly embedded bitfield structure inside other one?
- Is there any difference between master and tagged version? HOT 6
- Support `defmt` HOT 3
- attempt to shift right with overflow' HOT 1
- Feature request: Fields constructed of multiple ranges of bits HOT 4
- Feature request: Right-padded fields
- Generate masks for the fields HOT 3
- Feature Request: Derive Bitwise Operators HOT 2
- Support for `try_into` instead of `into`
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 rust-bitfield.