Skip to content

Commit

Permalink
Doc: Add Panic ection to high-level newtypes regarding default(). Add…
Browse files Browse the repository at this point in the history
… missing re-wording from Exceptions to Errors #60.
  • Loading branch information
brycx committed Mar 3, 2019
1 parent dc3f7c9 commit a6de584
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/hltypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ construct_secret_key_variable_size! {
/// handle a failing CSPRNG. If the CSPRNG fails, that function panics. If handling a failing CSPRNG's
/// error is needed, use instead `generate()`.
///
/// # Exceptions:
/// An exception will be thrown if:
/// # Errors:
/// An error will be returned if:
/// - `slice` is empty.
/// - The `OsRng` fails to initialize or read from its source.
/// - The `OsRng` fails to initialize or read from its source when using `SecretKey::generate()`.
/// - `length` is 0.
/// - `length` is not less than `u32::max_value()`.
///
/// # Panics:
/// A panic will occur if:
/// - The `OsRng` fails to initialize or read from its source when using `SecretKey::default()`.
(SecretKey, 32)
}

Expand All @@ -53,12 +57,16 @@ construct_salt_variable_size! {
/// handle a failing CSPRNG. If the CSPRNG fails, that function panics. If handling a failing CSPRNG's
/// error is needed, use instead `generate()`.
///
/// # Exceptions:
/// An exception will be thrown if:
/// # Errors:
/// An error will be returned if:
/// - `slice` is empty.
/// - The `OsRng` fails to initialize or read from its source.
/// - The `OsRng` fails to initialize or read from its source when using `Salt::generate()`.
/// - `length` is 0.
/// - `length` is not less than `u32::max_value()`.
///
/// # Panics:
/// A panic will occur if:
/// - The `OsRng` fails to initialize or read from its source when using `Salt::default()`.
(Salt, 64)
}

Expand All @@ -68,8 +76,8 @@ construct_tag! {
/// A `PasswordHash`'s first 64 bytes are the salt used to hash the password, and the last 64
/// bytes are the actual password hash.
///
/// # Exceptions:
/// An exception will be thrown if:
/// # Errors:
/// An error will be returned if:
/// - `slice` is not 128 bytes.
(PasswordHash, 128)
}
Expand All @@ -78,10 +86,10 @@ construct_password_variable_size! {
/// A type to represent the `Password` that PBKDF2 hashes and uses for key derivation.
///
///
/// # Exceptions:
/// An exception will be thrown if:
/// # Errors:
/// An error will be returned if:
/// - `slice` is empty.
/// - The `OsRng` fails to initialize or read from its source.
/// - The `OsRng` fails to initialize or read from its source when using `Password::generate()`.
/// - `length` is 0.
/// - `length` is not less than `u32::max_value()`.
(Password)
Expand Down

0 comments on commit a6de584

Please sign in to comment.