Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rust Docs CI #1271

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/rust-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Validate Rust Docs

on:
push:
branches:
- main
pull_request:

jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Find and Document All Crates
run: |
# Fail on any error
set -e

# Find all Cargo.toml files (crates) and run `cargo doc` for each
find . -name "Cargo.toml" | while read -r crate; do
crate_dir=$(dirname "$crate")
echo "Generating documentation for $crate_dir..."
(
cd "$crate_dir" || exit 1
cargo doc --all-features --no-deps
)
done
1 change: 1 addition & 0 deletions benches/benches/src/sv1/criterion_sv1_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! This code uses `criterion` crate to benchmark the performance sv1.
//! It measures connection time, send subscription latency and share submission time.

Expand Down
1 change: 1 addition & 0 deletions benches/benches/src/sv1/iai_sv1_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! The code uses iai library to measure the system requirements of sv1 client.

use iai::{black_box, main};
Expand Down
1 change: 1 addition & 0 deletions benches/benches/src/sv1/lib/client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! The defines a sv1 `Client` struct that handles message exchange with the server.
//! It includes methods for initializing the client, parsing messages, and sending various types of
//! messages. It also provides a trait implementation for handling server messages and managing
Expand Down
1 change: 1 addition & 0 deletions benches/benches/src/sv2/criterion_sv2_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use codec_sv2::{StandardEitherFrame, StandardSv2Frame};
use criterion::{black_box, Criterion};
use roles_logic_sv2::{
Expand Down
1 change: 1 addition & 0 deletions benches/benches/src/sv2/iai_sv2_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use codec_sv2::{StandardEitherFrame, StandardSv2Frame};
use iai::{black_box, main};
use roles_logic_sv2::{
Expand Down
1 change: 1 addition & 0 deletions benches/benches/src/sv2/lib/client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use bitcoin::{
blockdata::block::BlockHeader, hash_types::BlockHash, hashes::Hash, util::uint::Uint256,
};
Expand Down
1 change: 1 addition & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! # Stratum Common Crate
//!
//! `stratum_common` is a utility crate designed to centralize
Expand Down
1 change: 1 addition & 0 deletions examples/interop-cpp/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
fn main() -> Result<(), std::io::Error> {
use main_::main;
main()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
#[cfg(test)]
mod tests {
#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
#[cfg(test)]
mod tests {
#[test]
Expand Down
1 change: 1 addition & 0 deletions examples/ping-pong-with-noise/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
mod messages;
mod node;
use async_std::{
Expand Down
1 change: 1 addition & 0 deletions examples/ping-pong-with-noise/src/messages.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
#[cfg(not(feature = "with_serde"))]
use binary_sv2::{binary_codec_sv2, decodable::DecodableField, decodable::FieldMarker};
use binary_sv2::{Deserialize, GetSize, Seq064K, Serialize, Str0255, U24, U256};
Expand Down
1 change: 1 addition & 0 deletions examples/ping-pong-with-noise/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::messages::{Message, Ping, Pong};
use binary_sv2::{from_bytes, GetSize, U256};
use rand::Rng;
Expand Down
1 change: 1 addition & 0 deletions examples/ping-pong-without-noise/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
mod messages;
mod node;
use async_std::{
Expand Down
1 change: 1 addition & 0 deletions examples/ping-pong-without-noise/src/messages.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
#[cfg(not(feature = "with_serde"))]
use binary_sv2::{binary_codec_sv2, decodable::DecodableField, decodable::FieldMarker};
use binary_sv2::{Deserialize, GetSize, Seq064K, Serialize, Str0255, U24, U256};
Expand Down
1 change: 1 addition & 0 deletions examples/ping-pong-without-noise/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::messages::{Message, Ping, Pong};
use binary_sv2::{from_bytes, U256};
use rand::Rng;
Expand Down
1 change: 1 addition & 0 deletions examples/sv1-client-and-server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use async_std::net::{TcpListener, TcpStream};
use std::convert::{TryFrom, TryInto};

Expand Down
1 change: 1 addition & 0 deletions examples/template-provider-test/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use async_channel::{Receiver, Sender};
use async_std::net::TcpStream;
use codec_sv2::{StandardEitherFrame, StandardSv2Frame, Sv2Frame};
Expand Down
1 change: 1 addition & 0 deletions protocols/fuzz-tests/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_main]
#![deny(missing_docs)]
use libfuzzer_sys::fuzz_target;
use binary_codec_sv2::{Seq064K,U256,B0255,Seq0255};
use binary_codec_sv2::from_bytes;
Expand Down
1 change: 1 addition & 0 deletions protocols/v1/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{
methods::{Method, MethodError},
utils::HexU32Be,
Expand Down
1 change: 1 addition & 0 deletions protocols/v1/src/json_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! https://www.jsonrpc.org/specification#response_object
use serde::{Deserialize, Serialize};

Expand Down
1 change: 1 addition & 0 deletions protocols/v1/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::result_unit_err)]
#![deny(missing_docs)]
//! Startum V1 application protocol:
//!
//! json-rpc has two types of messages: **request** and **response**.
Expand Down
1 change: 1 addition & 0 deletions protocols/v1/src/methods/client_to_server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use bitcoin_hashes::hex::ToHex;
use serde_json::{
Value,
Expand Down
1 change: 1 addition & 0 deletions protocols/v1/src/methods/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::error::Error;
use bitcoin_hashes::Error as BTCHashError;
use hex::FromHexError;
Expand Down
1 change: 1 addition & 0 deletions protocols/v1/src/methods/server_to_client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use serde_json::{
Value,
Value::{Array as JArrary, Bool as JBool, Number as JNumber, String as JString},
Expand Down
1 change: 1 addition & 0 deletions protocols/v1/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::error::{self, Error};
use binary_sv2::{B032, U256};
use bitcoin_hashes::hex::{FromHex, ToHex};
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/binary-sv2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// TODO unify errors from serde_sv2 and no-serde-sv2

#![no_std]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{
codec::{GetSize, SizeHint},
datatypes::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{
codec::GetSize,
datatypes::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{
codec::{
decodable::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// At lower level I generally prefer to work with slices as more efficient than Read/Write streams
// eg: Read for & [u8] is implemented with memcpy but here is more than enough to just get a
// pointer to the original data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! Copy data types
use crate::{codec::Fixed, datatypes::Sv2DataType, Error};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{
codec::{GetSize, SizeHint},
Error,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use super::IntoOwned;
use crate::{
codec::{GetSize, SizeHint},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
#[cfg(feature = "prop_test")]
use quickcheck::{Arbitrary, Gen};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{
codec::{
decodable::{Decodable, DecodableField, FieldMarker, GetMarker, PrimitiveMarker},
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/no-serde-sv2/codec/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! ```txt
//! SERDE <-> Sv2
//! bool <-> BOOL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![deny(missing_docs)]

extern crate alloc;
extern crate proc_macro;
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/serde-sv2/src/de.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! Serde deserializer for [stratum v2][Sv2] implemented following [serde tutorial][tutorial]
//!
//! [Sv2]: https://docs.google.com/document/d/1FadCWj-57dvhxsnFM_7X806qyvhR0u3i85607bGHxvg/edit
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/serde-sv2/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use alloc::string::String;
use core::fmt::{self, Display};

Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/serde-sv2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! Serde serializer/deserializer for [stratum v2][Sv2] implemented following [serde
//! tutorial][tutorial]
//!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{error::Error, primitives::GetSize};
use alloc::vec::Vec;
use core::convert::{TryFrom, TryInto};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{error::Error, primitives::GetSize};
use alloc::{string::ToString, vec::Vec};
use core::convert::{TryFrom, TryInto};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{error::Error, primitives::GetSize};
use alloc::vec::Vec;
use core::convert::{TryFrom, TryInto};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{error::Error, primitives::GetSize};
use alloc::vec::Vec;
use core::convert::{TryFrom, TryInto};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::primitives::GetSize;
use alloc::vec::Vec;
use serde::{de::Visitor, ser, Deserialize, Deserializer, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
pub mod b016m;
pub mod b0255;
pub mod b032;
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/serde-sv2/src/primitives/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use alloc::{string::String, vec::Vec};
mod byte_arrays;
pub mod sequences;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use super::{ShortTxId, Signature, B016M, B0255, B064K, U24, U256};
use crate::Error;
use core::convert::TryInto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use super::{
super::{Signature, U24, U256},
Seq, SeqMaxLen, SeqVisitor, TryFromBSlice,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use super::{
super::{Signature, U24, U256},
Seq, SeqMaxLen, SeqVisitor, TryFromBSlice,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use super::{
super::{Signature, B016M, B064K, U24, U256},
Seq, SeqMaxLen, SeqVisitor, TryFromBSlice,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{error::Error, primitives::FixedSize};
use alloc::{boxed::Box, vec::Vec};
use core::convert::TryFrom;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{error::Error, primitives::FixedSize};
use alloc::boxed::Box;
use core::convert::TryFrom;
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/serde-sv2/src/primitives/u24.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::primitives::FixedSize;
use core::convert::TryFrom;
use serde::{de::Visitor, ser, Deserialize, Deserializer, Serialize};
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/serde-sv2/src/primitives/u256.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{error::Error, primitives::FixedSize};
use alloc::{boxed::Box, vec::Vec};
use core::convert::TryFrom;
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/serde-sv2/src/ser.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! Serde serializer for [stratum v2][Sv2] implemented following [serde tutorial][tutorial]
//!
//! Right now trying to serialize a value that is an invalid Sv2 type will result in a panic so
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/codec-sv2/examples/encrypted.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// # Using Sv2 Codec with Noise Encryption
//
// This example demonstrates how to use the `codec-sv2` crate to encode and decode Sv2 frames
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/codec-sv2/examples/unencrypted.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// # Using Sv2 Codec Without Encryption
//
// This example demonstrates how to use the `codec-sv2` crate to encode and decode Sv2 frames
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/codec-sv2/src/decoder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// # Decoder
//
// Provides utilities for decoding messages held by Sv2 frames, with or without Noise protocol
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/codec-sv2/src/encoder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// # Encoder
//
// Provides utilities for encoding messages into Sv2 frames, with or without Noise protocol
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/codec-sv2/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! # Error Handling and Result Types
//!
//! This module defines error types and utilities for handling errors in the `codec_sv2` module.
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/codec-sv2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! # Stratum V2 Codec Library
//!
//! `codec_sv2` provides the message encoding and decoding functionality for the Stratum V2 (Sv2)
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/const-sv2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! This crate provides all constants used in the SV2 protocol.
//! These constants are essential for message framing, encryption, and
//! protocol-specific identifiers across various SV2 components, including
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/framing-sv2/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// use crate::framing2::EitherFrame;
use core::fmt;

Expand Down
1 change: 1 addition & 0 deletions protocols/v2/framing-sv2/src/framing.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::{header::Header, Error};
use alloc::vec::Vec;
use binary_sv2::{to_writer, GetSize, Serialize};
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/framing-sv2/src/header.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
use crate::Error;
#[cfg(not(feature = "with_serde"))]
use alloc::vec::Vec;
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/framing-sv2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
//! The SV2 protocol is binary, with fixed message framing.
//! Each message begins with the extension type, message type, and message length (six bytes in
//! total), followed by a variable length message.
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/noise-sv2/examples/handshake.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// # Noise Protocol Handshake
//
// This example demonstrates how to use the `noise-sv2` crate to establish a Noise handshake
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/noise-sv2/src/aed_cipher.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// # AEAD Cipher
//
// Abstracts the encryption and decryption operations for authenticated encryption with associated
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/noise-sv2/src/cipher_state.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// # Cipher State Management
//
// Defines the [`CipherState`] trait and the [`GenericCipher`] enum, which manage the state of
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/noise-sv2/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(missing_docs)]
// # Error Handling
//
// Defines error types and utilities for handling errors in the `noise_sv2` module.
Expand Down
Loading
Loading