Skip to content

Commit

Permalink
docs: fix broken links and add CI (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI authored Jul 29, 2024
1 parent 4d5b408 commit 3a5537a
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 17 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
branches:
- "master"
pull_request:

name: "Build documentation"

jobs:
build-doc:
name: "Build documentation"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout source code"
uses: "actions/checkout@v3"

- name: "Setup stable toolchain"
uses: "actions-rs/toolchain@v1"
with:
toolchain: "stable"
profile: "minimal"
override: true

- name: "Build docs"
run: |
RUSTDOCFLAGS="-D warnings -A rustdoc::missing-crate-level-docs" cargo doc --all
2 changes: 1 addition & 1 deletion examples/starknet-cxx/starknet-cxx/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This is a quick demo on exposing `starknet-crypto` to C++ with the cxx bridge:
//! https://github.com/xJonathanLEI/starknet-rs/issues/325
//! <https://github.com/xJonathanLEI/starknet-rs/issues/325>
//!
//! This wrapper crate expose functions that operate on strings, which is bad and probably hurts
//! performance. It's possible to make the C++ side create `Felt` instances and operate on
Expand Down
2 changes: 1 addition & 1 deletion starknet-core/src/serde/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Custom serialization/deserialization implementations for [`Vec<u8>`].
pub mod byte_array;

/// Custom serialization/deserialization implementations for [`Felt`].
/// Custom serialization/deserialization implementations for [`Felt`](crate::types::Felt).
pub mod unsigned_field_element;

pub(crate) mod num_hex;
7 changes: 4 additions & 3 deletions starknet-core/src/types/eth_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct EthAddressVisitor;
mod errors {
use core::fmt::{Display, Formatter, Result};

/// Errors parsing [`EthAddress`] from a hex string.
/// Errors parsing [`EthAddress`](super::EthAddress) from a hex string.
#[derive(Debug)]
pub enum FromHexError {
/// The hex string is not 40 hexadecimal characters in length without the `0x` prefix.
Expand All @@ -32,11 +32,12 @@ mod errors {
InvalidHexString,
}

/// The [`Felt`] value is out of range for converting into [`EthAddress`].
/// The [`Felt`](super::Felt) value is out of range for converting into
/// [`EthAddress`](super::EthAddress).
#[derive(Debug)]
pub struct FromFieldElementError;

/// The byte slice is out of range for converting into [`EthAddress`].
/// The byte slice is out of range for converting into [`EthAddress`](super::EthAddress).
#[derive(Debug)]
pub struct FromBytesSliceError;

Expand Down
4 changes: 2 additions & 2 deletions starknet-core/src/types/hash_256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Hash256Visitor;
mod errors {
use core::fmt::{Display, Formatter, Result};

/// Errors parsing [`Hash256`] from a hex string.
/// Errors parsing [`Hash256`](super::Hash256) from a hex string.
#[derive(Debug)]
pub enum FromHexError {
/// The hex string is not 64 hexadecimal characters in length without the `0x` prefix.
Expand All @@ -29,7 +29,7 @@ mod errors {
InvalidHexString,
}

/// The hash value is out of range for converting into [`Felt`].
/// The hash value is out of range for converting into [`Felt`](super::Felt).
#[derive(Debug)]
pub struct ToFieldElementError;

Expand Down
3 changes: 2 additions & 1 deletion starknet-core/src/types/receipt_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use serde_with::serde_as;
use crate::serde::unsigned_field_element::UfeHex;
use starknet_types_core::felt::Felt;

/// Block identifier used in [`TransactionReceiptWithBlockInfo`].
/// Block identifier used in
/// [`TransactionReceiptWithBlockInfo`](super::TransactionReceiptWithBlockInfo).
///
/// Instead of directly exposing the `block_hash` and `block_number` fields as [`Option<Felt>`],
/// this struct captures the fact that these fields are always [`Some`](Option::Some) or
Expand Down
2 changes: 1 addition & 1 deletion starknet-core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ mod errors {
/// Possible errors for decoding a Cairo short string.
#[derive(Debug)]
pub enum ParseCairoShortStringError {
/// The encoded [`Felt`] value is out of range.
/// The encoded [`Felt`](super::Felt) value is out of range.
ValueOutOfRange,
/// A null terminator (`0x00`) is encountered.
UnexpectedNullTerminator,
Expand Down
2 changes: 1 addition & 1 deletion starknet-providers/src/jsonrpc/transports/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl HttpTransport {
}

/// Consumes the current [`HttpTransport`] instance and returns a new one with the header
/// appended. Same as calling [`add_header`].
/// appended. Same as calling [`add_header`](fn.add_header).
pub fn with_header(self, name: String, value: String) -> Self {
let mut headers = self.headers;
headers.push((name, value));
Expand Down
4 changes: 2 additions & 2 deletions starknet-providers/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ pub trait Provider {
where
B: AsRef<BlockId> + Send + Sync;

/// Same as [estimate_fee], but only with one estimate.
/// Same as [`estimate_fee`](fn.estimate_fee), but only with one estimate.
async fn estimate_fee_single<R, S, B>(
&self,
request: R,
Expand All @@ -271,7 +271,7 @@ pub trait Provider {
}
}

/// Same as [simulate_transactions], but only with one simulation.
/// Same as [`simulate_transactions`](fn.simulate_transactions), but only with one simulation.
async fn simulate_transaction<B, T, S>(
&self,
block_id: B,
Expand Down
12 changes: 7 additions & 5 deletions starknet-providers/src/sequencer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,18 @@ pub enum GatewayClientError {
/// Sequencer error responses not parsable into [`StarknetError`]
#[error(transparent)]
SequencerError(SequencerError),
/// Method is not supported (only when using as [Provider])
/// Method is not supported (only when using as [`Provider`](crate::Provider))
#[error("method not supported")]
MethodNotSupported,
/// Model conversion error (only when using as [Provider])
/// Model conversion error (only when using as [`Provider`](crate::Provider))
#[error("unable to convert gateway models to jsonrpc types")]
ModelConversionError,
/// Simulating multiple transactions is not supported (only when using as [Provider])
/// Simulating multiple transactions is not supported (only when using as
/// [`Provider`](crate::Provider))
#[error("simulating multiple transactions not supported")]
BulkSimulationNotSupported,
/// At least one of the simulation flags is not supported (only when using as [Provider])
/// At least one of the simulation flags is not supported (only when using as
/// [`Provider`](crate::Provider))
#[error("unsupported simulation flag")]
UnsupportedSimulationFlag,
}
Expand Down Expand Up @@ -140,7 +142,7 @@ impl SequencerGatewayProvider {
}

/// Consumes the current [`SequencerGatewayProvider`] instance and returns a new one with the
/// header appended. Same as calling [`add_header`].
/// header appended. Same as calling [`add_header`](fn.add_header).
pub fn with_header(self, name: String, value: String) -> Self {
let mut headers = self.headers;
headers.push((name, value));
Expand Down

0 comments on commit 3a5537a

Please sign in to comment.