Enum bitcoin::network::constants::Network [−][src]
pub enum Network { Bitcoin, Testnet, Regtest, }
The cryptocurrency to act on
Variants
Bitcoin
Classic Bitcoin
Testnet
Bitcoin's testnet
Regtest
Bitcoin's regtest
Methods
impl Network
[src]
impl Network
pub fn from_magic(magic: u32) -> Option<Network>
[src]
pub fn from_magic(magic: u32) -> Option<Network>
Creates a Network
from the magic bytes.
Examples
use bitcoin::network::constants::Network; assert_eq!(Some(Network::Bitcoin), Network::from_magic(0xD9B4BEF9)); assert_eq!(None, Network::from_magic(0xFFFFFFFF));
pub fn magic(&self) -> u32
[src]
pub fn magic(&self) -> u32
Return the network magic bytes, which should be encoded little-endian at the start of every message
Examples
use bitcoin::network::constants::Network; let network = Network::Bitcoin; assert_eq!(network.magic(), 0xD9B4BEF9);
Trait Implementations
impl Copy for Network
[src]
impl Copy for Network
impl PartialEq for Network
[src]
impl PartialEq for Network
fn eq(&self, other: &Network) -> bool
[src]
fn eq(&self, other: &Network) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Network
[src]
impl Eq for Network
impl PartialOrd for Network
[src]
impl PartialOrd for Network
fn partial_cmp(&self, other: &Network) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Network) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Network
[src]
impl Ord for Network
fn cmp(&self, other: &Network) -> Ordering
[src]
fn cmp(&self, other: &Network) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Clone for Network
[src]
impl Clone for Network
fn clone(&self) -> Network
[src]
fn clone(&self) -> Network
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Hash for Network
[src]
impl Hash for Network
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for Network
[src]
impl Debug for Network
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Network
[src]
impl Display for Network
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl FromStr for Network
[src]
impl FromStr for Network
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a string s
to return a value of this type. Read more
impl<S: SimpleEncoder> ConsensusEncodable<S> for Network
[src]
impl<S: SimpleEncoder> ConsensusEncodable<S> for Network
impl<D: SimpleDecoder> ConsensusDecodable<D> for Network
[src]
impl<D: SimpleDecoder> ConsensusDecodable<D> for Network