Unverified Commit 7fdf90f8 authored by Jonas Platte's avatar Jonas Platte
Browse files

Remove needless `fn main() {}` from doctests

parent 7e5f1ea2
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
//! use openssl::pkey::PKey;
//! use openssl::symm::Cipher;
//!
//! fn main() {
//! let rsa = Rsa::generate(2048).unwrap();
//! let key = PKey::from_rsa(rsa).unwrap();
//!
@@ -21,7 +20,6 @@
//! let mut enc_len = seal.update(secret, &mut encrypted).unwrap();
//! enc_len += seal.finalize(&mut encrypted[enc_len..]).unwrap();
//! encrypted.truncate(enc_len);
//! }
//! ```
use crate::error::ErrorStack;
use crate::pkey::{HasPrivate, HasPublic, PKey, PKeyRef};
+4 −6
Original line number Diff line number Diff line
@@ -33,13 +33,11 @@
//! use openssl::pkey::PKey;
//! use std::str;
//!
//! fn main() {
//! let rsa = Rsa::generate(2048).unwrap();
//! let pkey = PKey::from_rsa(rsa).unwrap();
//!
//! let pub_key: Vec<u8> = pkey.public_key_to_pem().unwrap();
//! println!("{:?}", str::from_utf8(pub_key.as_slice()).unwrap());
//! }
//! ```

use foreign_types::{ForeignType, ForeignTypeRef};
+4 −6
Original line number Diff line number Diff line
@@ -18,12 +18,10 @@
//! ```rust
//! use openssl::rsa::{Rsa, Padding};
//!
//! fn main() {
//! let rsa = Rsa::generate(2048).unwrap();
//! let data = b"foobar";
//! let mut buf = vec![0; rsa.size() as usize];
//! let encrypted_len = rsa.public_encrypt(data, &mut buf, Padding::PKCS1).unwrap();
//! }
//! ```
use foreign_types::{ForeignType, ForeignTypeRef};
use libc::c_int;
+7 −11
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
//! ```rust
//! use openssl::sha;
//!
//! fn main() {
//! let mut hasher = sha::Sha256::new();
//!
//! hasher.update(b"Hello, ");
@@ -24,7 +23,6 @@
//!
//! let hash = hasher.finish();
//! println!("Hashed \"Hello, world\" to {}", hex::encode(hash));
//! }
//! ```
//!
//! On the other hand, if you already have access to all of the data you woud like to hash, you
@@ -34,10 +32,8 @@
//! ```rust
//! use openssl::sha::sha256;
//!
//! fn main() {
//! let hash = sha256(b"your data or message");
//! println!("Hash = {}", hex::encode(hash));
//! }
//! ```
use libc::c_void;
use std::mem;
+3 −5
Original line number Diff line number Diff line
@@ -11,12 +11,10 @@
//! use openssl::x509::extension::BasicConstraints;
//! use openssl::x509::X509Extension;
//!
//! fn main() {
//! let mut bc = BasicConstraints::new();
//! let bc = bc.critical().ca().pathlen(1);
//!
//! let extension: X509Extension = bc.build().unwrap();
//! }
//! ```
use std::fmt::Write;

Loading