Skip to content

Commit

Permalink
Document behavior of digest_with_initial
Browse files Browse the repository at this point in the history
  • Loading branch information
voidc authored and akhilles committed Apr 19, 2022
1 parent 60861d8 commit 12c17fb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/crc128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ impl Crc<u128> {
self.digest_with_initial(self.algorithm.init)
}

/// Construct a `Digest` with a given initial value.
///
/// This overrides the initial value specified by the algorithm.
/// The effects of the algorithm's properties `refin` and `width`
/// are applied to the custom initial value.
pub const fn digest_with_initial(&self, initial: u128) -> Digest<u128> {
let value = self.init(initial);
Digest::new(self, value)
Expand Down
5 changes: 5 additions & 0 deletions src/crc16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ impl Crc<u16> {
self.digest_with_initial(self.algorithm.init)
}

/// Construct a `Digest` with a given initial value.
///
/// This overrides the initial value specified by the algorithm.
/// The effects of the algorithm's properties `refin` and `width`
/// are applied to the custom initial value.
pub const fn digest_with_initial(&self, initial: u16) -> Digest<u16> {
let value = self.init(initial);
Digest::new(self, value)
Expand Down
5 changes: 5 additions & 0 deletions src/crc32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ impl Crc<u32> {
self.digest_with_initial(self.algorithm.init)
}

/// Construct a `Digest` with a given initial value.
///
/// This overrides the initial value specified by the algorithm.
/// The effects of the algorithm's properties `refin` and `width`
/// are applied to the custom initial value.
pub const fn digest_with_initial(&self, initial: u32) -> Digest<u32> {
let value = self.init(initial);
Digest::new(self, value)
Expand Down
5 changes: 5 additions & 0 deletions src/crc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ impl Crc<u64> {
self.digest_with_initial(self.algorithm.init)
}

/// Construct a `Digest` with a given initial value.
///
/// This overrides the initial value specified by the algorithm.
/// The effects of the algorithm's properties `refin` and `width`
/// are applied to the custom initial value.
pub const fn digest_with_initial(&self, initial: u64) -> Digest<u64> {
let value = self.init(initial);
Digest::new(self, value)
Expand Down
5 changes: 5 additions & 0 deletions src/crc8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ impl Crc<u8> {
self.digest_with_initial(self.algorithm.init)
}

/// Construct a `Digest` with a given initial value.
///
/// This overrides the initial value specified by the algorithm.
/// The effects of the algorithm's properties `refin` and `width`
/// are applied to the custom initial value.
pub const fn digest_with_initial(&self, initial: u8) -> Digest<u8> {
let value = self.init(initial);
Digest::new(self, value)
Expand Down

0 comments on commit 12c17fb

Please sign in to comment.