Skip to content

Commit

Permalink
docs: improve network doc
Browse files Browse the repository at this point in the history
  • Loading branch information
h4sh3d committed Jul 11, 2022
1 parent 238b67e commit 9fc8416
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,16 +430,40 @@ impl FromStr for Network {

/// Defines a blockchain network, identifies in which context the system interacts with the
/// blockchain.
///
/// When adding support for a new blockchain in the library a [`From`] implementation must be
/// provided such that it is possible to know what blockchain network to use for each of the three
/// generic contexts: `mainnet`, `testnet`, and `local`.
///
/// ```rust
/// use farcaster_core::blockchain::Network;
///
/// pub enum MyNet {
/// MyNet,
/// Test,
/// Regtest,
/// }
///
/// impl From<Network> for MyNet {
/// fn from(net: Network) -> Self {
/// match net {
/// Network::Mainnet => Self::MyNet,
/// Network::Testnet => Self::Test,
/// Network::Local => Self::Regtest,
/// }
/// }
/// }
/// ```
#[derive(
Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Display, Serialize, Deserialize,
)]
#[display(Debug)]
pub enum Network {
/// Represents a real asset on his valuable network.
/// Valuable, real, assets on its production network.
Mainnet,
/// Represents non-valuable assets on test networks.
/// Non-valuable assets on its online test networks.
Testnet,
/// Local and private testnets.
/// Non-valuable assets on offline test network.
Local,
}

Expand Down

0 comments on commit 9fc8416

Please sign in to comment.