diff --git a/openssl/src/ec.rs b/openssl/src/ec.rs index 94b11e9328087a5f965c9863efddc697b5cd7798..592c40269795154a6dbfcbd9372140cc902f2c60 100644 --- a/openssl/src/ec.rs +++ b/openssl/src/ec.rs @@ -295,7 +295,7 @@ impl EcKey { /// /// # Example /// - /// ``` + /// ```no_run /// use openssl::bn::BigNumContext; /// use openssl::ec::*; /// use openssl::nid; @@ -304,13 +304,11 @@ impl EcKey { /// // get bytes from somewhere, i.e. this will not produce a valid key /// let public_key: Vec = vec![]; /// - /// // create a PKey from the binary form of a EcPoint - /// EcGroup::from_curve_name(nid::SECP256K1) - /// .and_then(|group| BigNumContext::new().map(|ctx| (group, ctx))) - /// .and_then(|(group, mut ctx)| EcPoint::from_bytes(&group, &public_key, &mut ctx) - /// .map(|point| (group, point) )) - /// .and_then(|(group, point)| EcKey::from_public_key(&group, &point)) - /// .and_then(|ec_key| PKey::from_ec_key(ec_key)); + /// // create an EcKey from the binary form of a EcPoint + /// let group = EcGroup::from_curve_name(nid::SECP256K1).unwrap(); + /// let mut ctx = BigNumContext::new().unwrap(); + /// let point = EcPoint::from_bytes(&group, &public_key, &mut ctx).unwrap(); + /// let key = EcKey::from_public_key(&group, &point); /// ``` pub fn from_public_key(group: &EcGroupRef, public_key: &EcPointRef) -> Result { unsafe {