Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no method named capture found for struct Vec<Screen> in the current scope #23

Closed
LeeeSe opened this issue Sep 25, 2022 · 5 comments · Fixed by #27
Closed

no method named capture found for struct Vec<Screen> in the current scope #23

LeeeSe opened this issue Sep 25, 2022 · 5 comments · Fixed by #27

Comments

@LeeeSe
Copy link

LeeeSe commented Sep 25, 2022

error[E0599]: no method named capture found for struct Vec<Screen> in the current scope
--> src/main.rs:10:28
|
10 | let mut image = screen.capture().unwrap();
| ^^^^^^^ method not found in Vec<Screen>

error[E0609]: no field id on type Vec<Screen>
--> src/main.rs:12:47
|
12 | fs::write(format!("target/{}.png", screen.id.to_string()), &buffer).unwrap();
| ^^ unknown field

error[E0599]: no method named capture_area found for struct Vec<Screen> in the current scope
--> src/main.rs:14:20
|
14 | image = screen.capture_area(300, 300, 300, 300).unwrap();
| ^^^^^^^^^^^^ method not found in Vec<Screen>

error[E0609]: no field id on type Vec<Screen>
--> src/main.rs:16:49
|
16 | fs::write(format!("target/{}-2.png", screen.id.to_string()), &buffer).unwrap();
| ^^ unknown field

Some errors have detailed explanations: E0599, E0609.
For more information about an error, try rustc --explain E0599.
error: could not compile screen_shot due to 4 previous errors

@LeeeSe
Copy link
Author

LeeeSe commented Sep 25, 2022

Chip:M1
System:macOS Ventura 13.0(Beta)

@nashaofu
Copy link
Owner

I don't have the MAC of the M1 chip,and the beta version of the system may not be supported

@zkxjzmswkwl
Copy link

zkxjzmswkwl commented Sep 25, 2022

Problem on Windows too.

Downgraded to 0.3.3 to solve.

@jlucaso1
Copy link

An example of working code:

let screens = Screen::all();
let screen = screens.unwrap()[0];
let image = screen.capture().unwrap();

@jowilkes
Copy link

jowilkes commented Nov 6, 2022

readme sample code still has the issue; source example is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants