Rename as_u32 -> to_u32
Rust naming conventions stipulate that conversion methods from owned -> owned for `Copy` types use the naming convention `to_`. This change makes the function name objectively better, however it makes no claims of being the 'best' name. We have had much discussion on using `to_standard` vs `to_u32` but are unable to reach consensus.
This commit is contained in:
parent
2bd71c3748
commit
d1753d7ff1
|
@ -855,8 +855,10 @@ impl EcdsaSigHashType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts to a u32
|
/// Converts [`EcdsaSigHashType`] to a `u32` sighash flag.
|
||||||
pub fn as_u32(self) -> u32 { self as u32 }
|
///
|
||||||
|
/// The returned value is guaranteed to be a valid according to standardness rules.
|
||||||
|
pub fn to_u32(self) -> u32 { self as u32 }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error returned when parsing `SigHashType` fails.
|
/// Error returned when parsing `SigHashType` fails.
|
||||||
|
|
|
@ -600,7 +600,7 @@ impl<R: Deref<Target=Transaction>> SigHashCache<R> {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tx.lock_time.consensus_encode(&mut writer)?;
|
self.tx.lock_time.consensus_encode(&mut writer)?;
|
||||||
sighash_type.as_u32().consensus_encode(&mut writer)?;
|
sighash_type.to_u32().consensus_encode(&mut writer)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue