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

Is documentation outdated? #395

Closed
oslfmt opened this issue Feb 8, 2022 · 1 comment · Fixed by #397
Closed

Is documentation outdated? #395

oslfmt opened this issue Feb 8, 2022 · 1 comment · Fixed by #397

Comments

@oslfmt
Copy link

oslfmt commented Feb 8, 2022

I'm basically running the code given in the first example code block of the documentation, just trying to generate a key pair. However, when running the code I get this error:

```error[E0599]: no function or associated item named new found for struct `OsRng` in the current scope
--> src/main.rs:7:26
|
7 | let mut rng = OsRng::new().expect("OsRng");
| ^^^ function or associated item not found in `OsRng`


Furthermore, I've included the rand feature in Cargo.toml:

secp256k1 = { version = "0.21.2", features = ["rand"] }
@tcharding
Copy link
Member

tcharding commented Feb 9, 2022

You need to enable feature rand-std which enables the rand dependency with std which is needed for OsRng (and also thread_rng).

Which means the example is wrong since it uses rand only. I'll fix it, thanks for pointing this out.

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.

2 participants