Comments (3)
Actually not sure how to solve this. Looks like the impl<N: Nice>
is required at the beginning, but deku has no way of knowing that bound.
from deku.
Nevermind, struct Test<N : Nice> {
fixes this.
from deku.
This isn't an issue with deku, just noting you need to use PhantomData for this to work:
use std::marker::PhantomData;
use deku::prelude::*;
trait Nice {}
struct Kind<N: Nice> {
n: N,
endian: deku::ctx::Endian,
}
#[derive(DekuRead)]
#[deku(ctx = "kind: Kind<N>")]
#[deku(endian = "kind.endian ")]
struct Test<N: Nice> {
whatever: u8,
#[deku(skip)]
phantom: PhantomData<N>,
}
fn main() {
}
Otherwise you get this error!:
error[E0392]: parameter `N` is never used
--> src/main.rs:13:13
|
13 | struct Test<N: Nice> {
| ^ unused parameter
|
= help: consider removing `N`, referring to it in a field, or using a marker such as `PhantomData`
For more information about this error, try `rustc --explain E0392`.
error: could not compile `testing` due to previous error
from deku.
Related Issues (20)
- Enable MIRI testing
- Help passing context around HOT 1
- Revisit enum id & type
- How to properly debug Deku input data? HOT 4
- Seemingly nonsensical vector count/read_size error HOT 2
- Conditional DekuWrite HOT 3
- Error: Parse("Too much data") using custom readers HOT 1
- Cant "count" from Some(field) directly - need as_ref().unwrap() HOT 1
- Passing a struct in ctx creates opaque error HOT 7
- Doc request: update for structs
- How to access enum-struct members? HOT 4
- Assert for tuple enum HOT 1
- Working with elements of Vec<StructUsingDeku> to get sum of their byte-sizes HOT 4
- Weird parsing with `bool` and non-aligned data. HOT 4
- Is there a way to pad by a variable number of bytes? HOT 3
- Roll a release? HOT 12
- Performance of `read_all` and `count` HOT 2
- Ability to ignore excess bytes HOT 1
- endian attribute breaks enum HOT 2
- Comply to `cond` attribute while encoding
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 deku.