Merge rust-bitcoin/rust-bitcoin#2815: Add `const` modifier to `Magic::from_bytes`
d2be969a51
Add `const fn Magic::from_bytes` patch for API files (Velnbur)b7458256af
Add `const` modifier to `Magic::from_bytes` (Velnbur) Pull request description: Resolves: rust-bitcoin/rust-bitcoin#2814 ACKs for top commit: apoelstra: ACKd2be969a51
Tree-SHA512: 4e8f24b665a2919bcf135333be097114d72f473684b14a8fdd4e8d82bf57e89b4166352f75f744105f76eddc9ffabcb07971a669a7c93dfff6928a3fe519a38f
This commit is contained in:
commit
aabaf6f2a3
|
@ -6372,6 +6372,7 @@ pub const fn bitcoin::blockdata::witness::Witness::new() -> Self
|
|||
pub const fn bitcoin::consensus::encode::VarInt::size(&self) -> usize
|
||||
pub const fn bitcoin::consensus::params::Params::new(network: bitcoin::network::Network) -> Self
|
||||
pub const fn bitcoin::network::Network::params(self) -> &'static bitcoin::consensus::params::Params
|
||||
pub const fn bitcoin::p2p::Magic::from_bytes(bytes: [u8; 4]) -> bitcoin::p2p::Magic
|
||||
pub const fn bitcoin::transaction::predict_weight_from_slices(inputs: &[bitcoin::blockdata::transaction::InputWeightPrediction], output_script_lens: &[usize]) -> bitcoin_units::weight::Weight
|
||||
pub enum bitcoin::EcdsaSighashType
|
||||
pub enum bitcoin::NetworkKind
|
||||
|
@ -8844,7 +8845,6 @@ pub fn bitcoin::p2p::Magic::consensus_encode<W: bitcoin_io::Write + core::marker
|
|||
pub fn bitcoin::p2p::Magic::eq(&self, other: &bitcoin::p2p::Magic) -> bool
|
||||
pub fn bitcoin::p2p::Magic::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::result::Result<(), core::fmt::Error>
|
||||
pub fn bitcoin::p2p::Magic::from(network: bitcoin::network::Network) -> bitcoin::p2p::Magic
|
||||
pub fn bitcoin::p2p::Magic::from_bytes(bytes: [u8; 4]) -> bitcoin::p2p::Magic
|
||||
pub fn bitcoin::p2p::Magic::from_params(params: impl core::convert::AsRef<bitcoin::consensus::params::Params>) -> Self
|
||||
pub fn bitcoin::p2p::Magic::from_str(s: &str) -> core::result::Result<bitcoin::p2p::Magic, Self::Err>
|
||||
pub fn bitcoin::p2p::Magic::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
|
||||
|
|
|
@ -6071,6 +6071,7 @@ pub const fn bitcoin::blockdata::witness::Witness::new() -> Self
|
|||
pub const fn bitcoin::consensus::encode::VarInt::size(&self) -> usize
|
||||
pub const fn bitcoin::consensus::params::Params::new(network: bitcoin::network::Network) -> Self
|
||||
pub const fn bitcoin::network::Network::params(self) -> &'static bitcoin::consensus::params::Params
|
||||
pub const fn bitcoin::p2p::Magic::from_bytes(bytes: [u8; 4]) -> bitcoin::p2p::Magic
|
||||
pub const fn bitcoin::transaction::predict_weight_from_slices(inputs: &[bitcoin::blockdata::transaction::InputWeightPrediction], output_script_lens: &[usize]) -> bitcoin_units::weight::Weight
|
||||
pub enum bitcoin::EcdsaSighashType
|
||||
pub enum bitcoin::NetworkKind
|
||||
|
@ -8378,7 +8379,6 @@ pub fn bitcoin::p2p::Magic::consensus_encode<W: bitcoin_io::Write + core::marker
|
|||
pub fn bitcoin::p2p::Magic::eq(&self, other: &bitcoin::p2p::Magic) -> bool
|
||||
pub fn bitcoin::p2p::Magic::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::result::Result<(), core::fmt::Error>
|
||||
pub fn bitcoin::p2p::Magic::from(network: bitcoin::network::Network) -> bitcoin::p2p::Magic
|
||||
pub fn bitcoin::p2p::Magic::from_bytes(bytes: [u8; 4]) -> bitcoin::p2p::Magic
|
||||
pub fn bitcoin::p2p::Magic::from_params(params: impl core::convert::AsRef<bitcoin::consensus::params::Params>) -> Self
|
||||
pub fn bitcoin::p2p::Magic::from_str(s: &str) -> core::result::Result<bitcoin::p2p::Magic, Self::Err>
|
||||
pub fn bitcoin::p2p::Magic::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
|
||||
|
|
|
@ -5453,6 +5453,7 @@ pub const fn bitcoin::blockdata::witness::Witness::new() -> Self
|
|||
pub const fn bitcoin::consensus::encode::VarInt::size(&self) -> usize
|
||||
pub const fn bitcoin::consensus::params::Params::new(network: bitcoin::network::Network) -> Self
|
||||
pub const fn bitcoin::network::Network::params(self) -> &'static bitcoin::consensus::params::Params
|
||||
pub const fn bitcoin::p2p::Magic::from_bytes(bytes: [u8; 4]) -> bitcoin::p2p::Magic
|
||||
pub const fn bitcoin::transaction::predict_weight_from_slices(inputs: &[bitcoin::blockdata::transaction::InputWeightPrediction], output_script_lens: &[usize]) -> bitcoin_units::weight::Weight
|
||||
pub enum bitcoin::EcdsaSighashType
|
||||
pub enum bitcoin::NetworkKind
|
||||
|
@ -7711,7 +7712,6 @@ pub fn bitcoin::p2p::Magic::consensus_encode<W: bitcoin_io::Write + core::marker
|
|||
pub fn bitcoin::p2p::Magic::eq(&self, other: &bitcoin::p2p::Magic) -> bool
|
||||
pub fn bitcoin::p2p::Magic::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::result::Result<(), core::fmt::Error>
|
||||
pub fn bitcoin::p2p::Magic::from(network: bitcoin::network::Network) -> bitcoin::p2p::Magic
|
||||
pub fn bitcoin::p2p::Magic::from_bytes(bytes: [u8; 4]) -> bitcoin::p2p::Magic
|
||||
pub fn bitcoin::p2p::Magic::from_params(params: impl core::convert::AsRef<bitcoin::consensus::params::Params>) -> Self
|
||||
pub fn bitcoin::p2p::Magic::from_str(s: &str) -> core::result::Result<bitcoin::p2p::Magic, Self::Err>
|
||||
pub fn bitcoin::p2p::Magic::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
|
||||
|
|
|
@ -223,7 +223,7 @@ impl Magic {
|
|||
pub const REGTEST: Self = Self([0xFA, 0xBF, 0xB5, 0xDA]);
|
||||
|
||||
/// Create network magic from bytes.
|
||||
pub fn from_bytes(bytes: [u8; 4]) -> Magic { Magic(bytes) }
|
||||
pub const fn from_bytes(bytes: [u8; 4]) -> Magic { Magic(bytes) }
|
||||
|
||||
/// Get network magic bytes.
|
||||
pub fn to_bytes(self) -> [u8; 4] { self.0 }
|
||||
|
|
Loading…
Reference in New Issue