RustCrypto / RSA

RSA implementation in pure Rust
Apache License 2.0
550 stars 153 forks source link

Example in ReadMe.md is not update to date #273

Closed brmmm3 closed 1 year ago

brmmm3 commented 1 year ago

In older versions of rsa trait the implementation like in the ReadMe example worked. But with the newer version it doesn't compile with the following errors:

add `dyn` keyword before this trait
   |
16 |     let dec_data = priv_key.decrypt(<dyn PaddingScheme>::new_pkcs1v15_encrypt(), &enc_data).expect("failed to decrypt");

and

error[E0599]: no function or associated item named `new_pkcs1v15_encrypt` found for trait object `dyn PaddingScheme` in the current scope
  --> tests/pkcs1v15.rs:16:52

Please update the example.

tarcieri commented 1 year ago

It'd probably be good to shift to using #![doc = include_str!("../README.md")] in lib.rs, which both unifies the documentation in the README.md and rustdoc, and also doctests the examples in README.md so as to avoid this problem in perpetuity.

tarcieri commented 1 year ago

Fixed in #276