Open The-Real-Thisas opened 1 year ago
Same thing here, to fix (not tested thought) just do what the compiler says: Line 230: bytes_per_row: Some(width_nonzero), Line 231: rows_per_image: Some(height_nonzero),
Facing this issue as well
I think this can be closed after https://github.com/l1npengtul/nokhwa/pull/142 and thus is duplicated by #141.
I agree that it can be closed, but it would also be nice if 0.10.5 crate was released so people don't have to pull directly from the git repo for the fix
@mangoleaf @ahirner Actually, this issue still stands even to the date. I'm using M1 mac if that helps.
@Kofituo The fix was merged in #142, but the rust crate was never released since. This worked for me when I checked out the latest code instead of trying to get the crate via crates.io. I am also on an M1 mac.
@mangoleaf @ahirner That's surprising. Here's my full project https://github.com/Kofituo/sample_gui/blob/master
Here's the full list of errors I'm facing. They're mostly syntax errors, among others:
// cargo run
Compiling nokhwa-core v0.2.0 (https://github.com/l1npengtul/nokhwa.git#f0bbbf32)
error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `:`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:20:35
|
20 | self.$name: Option<Range<$range_type>> = Some(Range {
| ^ expected one of 7 possible tokens
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `:`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:45:35
|
45 | self.$name: Option<Range<$range_type>> = Some(Range {
| ^ expected one of 7 possible tokens
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `:`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:60:35
|
60 | self.$name: Option<Range<$range_type>> = Some(Range {
| ^ expected one of 7 possible tokens
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `:`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:76:35
|
76 | self.$name: Option<Range<$range_type>> = Some(Range {
| ^ expected one of 7 possible tokens
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `:`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:91:35
|
91 | self.$name: Option<Range<$range_type>> = Some(Range {
| ^ expected one of 7 possible tokens
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `:`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:115:35
|
115 | self.$name: Option<Range<$range_type>> = Some(Range {
| ^ expected one of 7 possible tokens
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected `;`, found keyword `Self`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:125:35
|
125 | self.$name = $name
| ^ help: add `;` here
126 | Self
| ---- unexpected token
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:14:46
|
14 | pub fn [< with_maximum_ $name >](mut self, $name: $range_type) -> Self {
| ^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:30:47
|
30 | pub fn [< reset_maximum_ $name >](mut self) -> Self {
| ^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:39:45
|
39 | pub fn [< set_maximum_ $name >](&mut self, $name: Option<$range_type>) {
| ^^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:54:48
|
54 | pub fn [< with_preferred_ $name >](mut self, $name: $range_type) -> Self {
| ^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:70:47
|
70 | pub fn [< set_preferred_ $name >](&mut self, $name: $range_type) {
| ^^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:85:46
|
85 | pub fn [< with_minimum_ $name >](mut self, $name: $range_type) -> Self {
| ^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:101:47
|
101 | pub fn [< reset_minimum_ $name >](mut self) -> Self {
| ^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:109:45
|
109 | pub fn [< set_minimum_ $name >](&mut self, $name: Option<$range_type>) {
| ^^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:124:45
|
124 | pub fn [< with_ $name _range >](mut self, $name: Option<Range<$range_type>>) -> Self {
| ^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `self` parameter is only allowed in associated functions
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:129:44
|
129 | pub fn [< set_ $name _range >](&mut self, $name: Option<Range<$range_type>>) {
| ^^^^^^^^^ not semantically valid as function parameter
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `serde`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/decoder.rs:3:5
|
3 | use serde::de::Error;
| ^^^^^ use of undeclared crate or module `serde`
error[E0432]: unresolved import `crate::frame_format::SourceFrameFormat`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/buffer.rs:17:13
|
17 | use crate::{frame_format::SourceFrameFormat, types::Resolution};
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `SourceFrameFormat` in `frame_format`
error[E0432]: unresolved import `crate::frame_format::SourceFrameFormat`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:1:5
|
1 | use crate::frame_format::SourceFrameFormat;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `SourceFrameFormat` in `frame_format`
error[E0432]: unresolved imports `crate::format_request::FormatFilter`, `crate::frame_format::SourceFrameFormat`
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/traits.rs:20:5
|
20 | format_request::FormatFilter,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `FormatFilter` in `format_request`
21 | frame_format::SourceFrameFormat,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `SourceFrameFormat` in `frame_format`
error[E0412]: cannot find type `RgbAFormat` in this scope
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/buffer.rs:173:50
|
173 | let frame = self.frame()?.decode_image::<RgbAFormat>()?;
| ^^^^^^^^^^ not found in this scope
|
help: you might be missing a type parameter
|
162 | impl<RgbAFormat> Buffer {
| ++++++++++++
error[E0411]: cannot find type `Self` in this scope
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:14:79
|
14 | pub fn [< with_maximum_ $name >](mut self, $name: $range_type) -> Self {
| ------------------------- `Self` not allowed in a function ^^^^ `Self` is only available in impls, traits, and type definitions
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0411]: cannot find type `Self` in this scope
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:30:60
|
30 | pub fn [< reset_maximum_ $name >](mut self) -> Self {
| -------------------------- ^^^^ `Self` is only available in impls, traits, and type definitions
| |
| `Self` not allowed in a function
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0411]: cannot find type `Self` in this scope
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:54:81
|
54 | pub fn [< with_preferred_ $name >](mut self, $name: $range_type) -> Self {
| --------------------------- `Self` not allowed in a function ^^^^ `Self` is only available in impls, traits, and type definitions
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0411]: cannot find type `Self` in this scope
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:85:79
|
85 | pub fn [< with_minimum_ $name >](mut self, $name: $range_type) -> Self {
| ------------------------- `Self` not allowed in a function ^^^^ `Self` is only available in impls, traits, and type definitions
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0411]: cannot find type `Self` in this scope
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:101:60
|
101 | pub fn [< reset_minimum_ $name >](mut self) -> Self {
| -------------------------- ^^^^ `Self` is only available in impls, traits, and type definitions
| |
| `Self` not allowed in a function
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0411]: cannot find type `Self` in this scope
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:124:93
|
124 | pub fn [< with_ $name _range >](mut self, $name: Option<Range<$range_type>>) -> Self {
| ------------------------ `Self` not allowed in a function ^^^^ `Self` is only available in impls, traits, and type definitions
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `Self` in this scope
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/format_request.rs:126:17
|
126 | Self
| ^^^^ help: a local variable with a similar name exists (notice the capitalization): `self`
...
210 | range_set_fields!((Resolution, resolution), (u32, frame_rate),);
| --------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `range_set_fields` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0223]: ambiguous associated type
--> /Users/kofiotuo/.cargo/git/checkouts/nokhwa-66b597f0abb1b795/f0bbbf3/nokhwa-core/src/decoder.rs:14:37
|
14 | type Container: Deref<Target = [Pixel::Subpixel]>;
| ^^^^^^^^^^^^^^^
|
help: if there were a type named `Example` that implemented `Pixel`, you could use the fully-qualified path
|
14 | type Container: Deref<Target = [<Example as Pixel>::Subpixel]>;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some errors have detailed explanations: E0223, E0411, E0412, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0223`.
error: could not compile `nokhwa-core` (lib) due to 30 previous errors
@Kofituo I was facing the same issue on mac m1, but using the pull #142, commit "8987af8", It compiles fine on my machine.
@MohammadKurjieh I guess the crate just isn't updated ?
Cargo.toml
main.rs
Output