Improve rustdocs for KeyPair
Currently the rustdocs for `KeyPair` are stale in regards to serde, we _do_ implement `Serialize` and `Deserialize` for `KeyPair`. Improve the rustdocs for `KeyPair` by removing stale docs and adding docs on fixed width binary serialization.
This commit is contained in:
parent
6842383161
commit
c28808c5a4
15
src/key.rs
15
src/key.rs
|
@ -715,13 +715,10 @@ impl Ord for PublicKey {
|
||||||
///
|
///
|
||||||
/// # Serde support
|
/// # Serde support
|
||||||
///
|
///
|
||||||
/// [`Serialize`] and [`Deserialize`] are not implemented for this type, even with the `serde`
|
/// Implements de/serialization with the `serde` and_`global-context` features enabled. Serializes
|
||||||
/// feature active. This is due to security considerations, see the [`serde_keypair`] documentation
|
/// the secret bytes only. We treat the byte value as a tuple of 32 `u8`s for non-human-readable
|
||||||
/// for details.
|
/// formats. This representation is optimal for for some formats (e.g. [`bincode`]) however other
|
||||||
///
|
/// formats may be less optimal (e.g. [`cbor`]). For human-readable formats we use a hex string.
|
||||||
/// If the `serde` and `global-context` features are active `KeyPair`s can be serialized and
|
|
||||||
/// deserialized by annotating them with `#[serde(with = "secp256k1::serde_keypair")]`
|
|
||||||
/// inside structs or enums for which [`Serialize`] and [`Deserialize`] are being derived.
|
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
@ -736,8 +733,8 @@ impl Ord for PublicKey {
|
||||||
/// let key_pair = KeyPair::from_secret_key(&secp, &secret_key);
|
/// let key_pair = KeyPair::from_secret_key(&secp, &secret_key);
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
/// [`Deserialize`]: serde::Deserialize
|
/// [`bincode`]: https://docs.rs/bincode
|
||||||
/// [`Serialize`]: serde::Serialize
|
/// [`cbor`]: https://docs.rs/cbor
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct KeyPair(ffi::KeyPair);
|
pub struct KeyPair(ffi::KeyPair);
|
||||||
impl_display_secret!(KeyPair);
|
impl_display_secret!(KeyPair);
|
||||||
|
|
Loading…
Reference in New Issue