Skip to content

Commit

Permalink
feat(cli): update rustdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
slavik-pastushenko committed Oct 21, 2024
1 parent d3cd829 commit 06b5ece
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 36 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- 'src/**.rs'

env:
CI: true
CARGO_TERM_COLOR: always

jobs:
Expand All @@ -27,7 +28,7 @@ jobs:
- name: Run build
run: cargo build
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --all-features --no-deps -- -D warnings
- name: Run lint
run: cargo fmt -- --check
- name: Run tests
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blockchain-cli"
description = "A Rust crate provides an interface for interacting with a blockchain"
description = "A Rust crate provides an interface for interacting with a blockchain."
version = "1.0.25"
edition = "2021"
license = "MIT"
Expand All @@ -10,7 +10,7 @@ keywords = ["cli", "crypto", "blockchain"]
exclude = [".github/**", "examples/**"]
categories = ["command-line-utilities", "cryptography"]
documentation = "https://docs.rs/blockchain-cli"
repository = "https://github.com/slavik-pastushenko/blockchain-rust"
repository = "https://github.com/slavik-pastushenko/blockchain-rs"

[lib]
name = "blockchain"
Expand All @@ -19,6 +19,6 @@ path = "src/lib.rs"
[dependencies]
chrono = "0.4.38"
rand = "0.8.5"
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.121"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0.132"
sha2 = "0.10.8"
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ A Rust crate provides an interface for interacting with a blockchain.

## Reference implementation

[![test](https://github.com/slavik-pastushenko/blockchain-rust/actions/workflows/test.yml/badge.svg)](https://github.com/slavik-pastushenko/blockchain-rust/actions/workflows/test.yml)
[![release](https://github.com/slavik-pastushenko/blockchain-rust/actions/workflows/release.yml/badge.svg?event=workflow_dispatch)](https://github.com/slavik-pastushenko/blockchain-rust/actions/workflows/release.yml)
[![test](https://github.com/slavik-pastushenko/blockchain-rs/actions/workflows/test.yml/badge.svg)](https://github.com/slavik-pastushenko/blockchain-rs/actions/workflows/test.yml)
[![release](https://github.com/slavik-pastushenko/blockchain-rs/actions/workflows/release.yml/badge.svg?event=workflow_dispatch)](https://github.com/slavik-pastushenko/blockchain-rs/actions/workflows/release.yml)
[![docs](https://docs.rs/blockchain-cli/badge.svg)](https://docs.rs/blockchain-cli)
[![crate](https://img.shields.io/crates/v/blockchain-cli.svg)](https://crates.io/crates/blockchain-cli)
![downloads](https://img.shields.io/crates/d/blockchain-cli)
[![codecov](https://codecov.io/gh/slavik-pastushenko/blockchain-rust/graph/badge.svg?token=9EL0F6725A)](https://codecov.io/gh/slavik-pastushenko/blockchain-rust)
[![codecov](https://codecov.io/gh/slavik-pastushenko/blockchain-rs/graph/badge.svg?token=9EL0F6725A)](https://codecov.io/gh/slavik-pastushenko/blockchain-rs)

![Features](https://github.com/slavik-pastushenko/blockchain-rust/assets/16807375/28123ed1-aa79-40d7-a59a-3a0710acc381)
![Features](https://github.com/slavik-pastushenko/blockchain-rs/assets/16807375/28123ed1-aa79-40d7-a59a-3a0710acc381)

## Features

Expand Down Expand Up @@ -48,14 +48,14 @@ This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in

For more in-depth details, please refer to the full [documentation](https://docs.rs/blockchain-cli).

If you encounter any issues or have questions that are not addressed in the documentation, feel free to [submit an issue](https://github.com/slavik-pastushenko/blockchain-rust/issues).
If you encounter any issues or have questions that are not addressed in the documentation, feel free to [submit an issue](https://github.com/slavik-pastushenko/blockchain-rs/issues).

## Examples

Explore the capabilities of this blockchain implementation through a set of examples:

- CLI for interacting with the blockchain: [see more](https://github.com/slavik-pastushenko/blockchain-rust/tree/main/examples/cli)
- API for interacting with the blockchain using axum: [see more](https://github.com/slavik-pastushenko/blockchain-rust/tree/main/examples/api-axum)
- CLI for interacting with the blockchain: [see more](https://github.com/slavik-pastushenko/blockchain-rs/tree/main/examples/cli)
- API for interacting with the blockchain using axum: [see more](https://github.com/slavik-pastushenko/blockchain-rs/tree/main/examples/api-axum)

## Usage

Expand Down Expand Up @@ -116,7 +116,7 @@ cargo run
Run [clippy](https://github.com/rust-lang/rust-clippy):

```bash
cargo clippy --all-targets --all-features -- -D warnings
cargo clippy --all-targets --all-features --no-deps -- -D warnings
```

Run [lint](https://github.com/rust-lang/rustfmt):
Expand Down
24 changes: 12 additions & 12 deletions examples/api-axum/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ pub struct GetTransactionsInput {
///
/// # Arguments
///
/// - `state` - The application state.
/// - `body` - The request body.
/// - `state`: The application state.
/// - `body`: The request body.
///
/// # Returns
///
Expand All @@ -91,8 +91,8 @@ pub async fn create_wallet(
///
/// # Arguments
///
/// - `state` - The application state.
/// - `params` - The request query parameters.
/// - `state`: The application state.
/// - `params`: The request query parameters.
///
/// # Returns
///
Expand All @@ -117,8 +117,8 @@ pub async fn get_wallet_balance(
///
/// # Arguments
///
/// - `state` - The application state.
/// - `params` - The request query parameters.
/// - `state`: The application state.
/// - `params`: The request query parameters.
///
/// # Returns
///
Expand All @@ -143,8 +143,8 @@ pub async fn get_wallet_transactions(
///
/// # Arguments
///
/// - `state` - The application state.
/// - `params` - The request query parameters.
/// - `state`: The application state.
/// - `params`: The request query parameters.
///
/// # Returns
///
Expand All @@ -163,8 +163,8 @@ pub async fn get_transactions(
///
/// # Arguments
///
/// - `state` - The application state.
/// - `hash` - The transaction hash.
/// - `state`: The application state.
/// - `hash`: The transaction hash.
///
/// # Returns
///
Expand All @@ -189,8 +189,8 @@ pub async fn get_transaction(
///
/// # Arguments
///
/// - `state` - The application state.
/// - `body` - The request body.
/// - `state`: The application state.
/// - `body`: The request body.
///
/// # Returns
///
Expand Down
4 changes: 2 additions & 2 deletions src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ impl Block {
///
/// # Arguments
///
/// - `previous_hash` - The hash of the previous block.
/// - `difficulty` - The difficulty level of the network.
/// - `previous_hash`: The hash of the previous block.
/// - `difficulty`: The difficulty level of the network.
///
/// # Returns
///
Expand Down
4 changes: 2 additions & 2 deletions src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use sha2::{Digest, Sha256};

use crate::{Block, Transaction, Wallet};

/// A blockchain.
/// Blockchain.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Chain {
/// Chain of blocks.
Expand Down Expand Up @@ -40,7 +40,7 @@ impl Chain {
/// - `fee`: The transaction fee.
///
/// # Returns
/// A new `Chain` instance with the given parameters and a genesis block.
/// New `Chain` instance with the given parameters and a genesis block.
pub fn new(difficulty: f64, reward: f64, fee: f64) -> Self {
let mut chain = Chain {
fee,
Expand Down
8 changes: 4 additions & 4 deletions src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ impl Transaction {
///
/// # Arguments
///
/// - `from` - The transaction sender address.
/// - `to` - The transaction receiver address.
/// - `fee` - The transaction fee.
/// - `amount` - The transaction amount.
/// - `from`: The transaction sender address.
/// - `to`: The transaction receiver address.
/// - `fee`: The transaction fee.
/// - `amount`: The transaction amount.
///
/// # Returns
///
Expand Down
6 changes: 3 additions & 3 deletions src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ impl Wallet {
///
/// # Arguments
///
/// - `email` - The email address associated with the wallet.
/// - `address` - The address uniquely identifying the wallet.
/// - `balance` - The current balance of the wallet.
/// - `email`: The email address associated with the wallet.
/// - `address`: The address uniquely identifying the wallet.
/// - `balance`: The current balance of the wallet.
///
/// # Returns
///
Expand Down

0 comments on commit 06b5ece

Please sign in to comment.