diff options
author | johnthagen <johnthagen@gmail.com> | 2017-09-28 14:25:39 -0400 |
---|---|---|
committer | johnthagen <johnthagen@gmail.com> | 2017-09-28 14:25:39 -0400 |
commit | b65540709fce62edbc07b87e71310367a5acefb7 (patch) | |
tree | 25f863b01f3e40bbe305ae9eca1b084f98b4f0ca /openssl/src/nid.rs | |
parent | 67ca96a0b8707295de53c598f30c2e300ba17e30 (diff) | |
download | rust-openssl-b65540709fce62edbc07b87e71310367a5acefb7.zip |
Document nid module
Diffstat (limited to 'openssl/src/nid.rs')
-rw-r--r-- | openssl/src/nid.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/openssl/src/nid.rs b/openssl/src/nid.rs index afbd60a5..df1090c1 100644 --- a/openssl/src/nid.rs +++ b/openssl/src/nid.rs @@ -1,15 +1,43 @@ +//! A collection of numerical identifiers for OpenSSL objects. use ffi; use libc::c_int; +/// A numerical identifier for an OpenSSL object. +/// +/// Objects in OpenSSL can have a short name, a long name, and +/// a numerical identifier (NID). For convenience, objects +/// are usually represented in source code using these numeric +/// identifiers. +/// +/// Users should generally not need to create new `Nid`s. +/// +/// # Examples +/// +/// To view the integer representation of a `Nid`: +/// +/// ``` +/// use openssl::nid; +/// +/// assert!(nid::AES_256_GCM.as_raw() == 901); +/// ``` +/// +/// # External Documentation +/// +/// The following documentation provides context about `Nid`s and their usage +/// in OpenSSL. +/// +/// - [Obj_nid2obj](https://www.openssl.org/docs/man1.1.0/crypto/OBJ_create.html) #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct Nid(c_int); #[allow(non_snake_case)] impl Nid { + /// Create a `Nid` from an integer representation. pub fn from_raw(raw: c_int) -> Nid { Nid(raw) } + /// Return the integer representation of a `Nid`. pub fn as_raw(&self) -> c_int { self.0 } |