Skip to content

Commit

Permalink
rustdoc: enforce rustdocs to build without warnings in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed Jan 22, 2025
1 parent a9a930d commit 9e4be95
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ wasm: ## Build WASM modules

.PHONY: doc
doc: ## Generate documentation
RUSTDOCFLAGS="--cfg=doc_cfg -Zunstable-options --generate-link-to-definition" RUSTC_BOOTSTRAP=1 cargo doc --all-features --no-deps
RUSTDOCFLAGS="-Dwarnings --cfg=doc_cfg -Zunstable-options --generate-link-to-definition" RUSTC_BOOTSTRAP=1 cargo doc --all-features --no-deps

.PHONY: doc-open
doc-open: ## Generate and open documentation
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-graphql-client-build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sui-graphql-client-build = { git = "https://github.com/mystenlabs/sui-rust-sdk",
```

4. If using `cynic`, use the cynic generator to generate the Rust types from the GraphQL schema. \
Go to https://generator.cynic-rs.dev/ and paste the URL to the GraphQL service or manually copy paste the schema. \
Go to <https://generator.cynic-rs.dev/> and paste the URL to the GraphQL service or manually copy paste the schema. \
Then you can select the fields in the query you want to have, and the generator will generate the Rust types for you.

5. In your Rust code, you can now use the custom query types generated by `cynic`.
Expand All @@ -57,6 +57,6 @@ async fn main() {
}
```

6. For `UInt53`, you can use `u64` type directly as the `sui-graphql-client`'s schema implements the `impl_scalar`. Similarly for other types (Base64, DateTime). See more available types here: https://github.com/MystenLabs/sui-rust-sdk/blob/02639f6b09375fe03fa2243868be17bec1dfa33c/crates/sui-graphql-client/src/query_types/mod.rs?plain=1#L124-L126
6. For `UInt53`, you can use `u64` type directly as the `sui-graphql-client`'s schema implements the `impl_scalar`. Similarly for other types (Base64, DateTime). See more available types here: <https://github.com/MystenLabs/sui-rust-sdk/blob/02639f6b09375fe03fa2243868be17bec1dfa33c/crates/sui-graphql-client/src/query_types/mod.rs?plain=1#L124-L126>

7. Read the `cynic` [documentation](https://cynic-rs.dev/) to learn how to work with it, particularly when it comes to passing arguments to the query.
2 changes: 1 addition & 1 deletion crates/sui-graphql-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async fn main() -> Result<()> {
```

### Example for custom faucet service.
Note that this [`FaucetClient`] is explicitly designed to work with two endpoints: `v1/gas`, and `v1/status`. When passing in the custom faucet URL, skip the final endpoint and only pass in the top-level url (e.g., `https://faucet.devnet.sui.io`).
Note that this `FaucetClient` is explicitly designed to work with two endpoints: `v1/gas`, and `v1/status`. When passing in the custom faucet URL, skip the final endpoint and only pass in the top-level url (e.g., `https://faucet.devnet.sui.io`).
```rust, no_run
use sui_graphql_client::faucet::FaucetClient;
use sui_types::Address;
Expand Down
4 changes: 3 additions & 1 deletion crates/sui-graphql-client/src/streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ where
/// Creates a new `PageStream` for a paginated query.
///
/// Examples
///
/// ```rust,ignore
/// use futures::StreamExt;
/// use sui_graphql_client::streams::stream_paginated_query;
Expand All @@ -160,8 +161,9 @@ where
///
/// let client = Client::new_testnet();
/// let stream = stream_paginated_query(|pagination_filter, Direction::Forward| {
/// client.coins(owner, coin_type, pagination_filter })
/// client.coins(owner, coin_type, pagination_filter)
/// });
///
/// while let Some(result) = stream.next().await {
/// match result {
/// Ok(coin) => println!("Got coin: {:?}", coin),
Expand Down
8 changes: 4 additions & 4 deletions crates/sui-transaction-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use sui_types::Upgrade;
use base64ct::Encoding;
use serde::Serialize;

/// A builder for creating transactions. Use [`resolve`] to finalize the transaction data.
/// A builder for creating transactions. Use `resolve` to finalize the transaction data.
#[derive(Clone, Default, Debug)]
pub struct TransactionBuilder {
/// The inputs to the transaction.
Expand Down Expand Up @@ -95,7 +95,7 @@ impl TransactionBuilder {

/// Add one or more gas objects to use to pay for the transaction.
///
/// Most commonly the gas can be passed as a reference to an owned/immutable [`Object`],
/// Most commonly the gas can be passed as a reference to an owned/immutable `Object`,
/// or can created using one of the of the constructors of the [`unresolved::Input`] enum,
/// e.g., [`unresolved::Input::owned`].
pub fn add_gas_objects<O, I>(&mut self, gas: I)
Expand Down Expand Up @@ -227,7 +227,7 @@ impl TransactionBuilder {
///
/// let mut tx = TransactionBuilder::new();
/// let package_id = "0x...".parse().unwrap();
/// let upgrade_cap = tx.input(unresolved::Input::by_id("0x...".parse().unwrap());
/// let upgrade_cap = tx.input(unresolved::Input::by_id("0x...".parse().unwrap()));
/// let upgrade_policy = tx.input(Serialized(&0u8));
/// // the digest of the new package that was compiled
/// let package_digest: &[u8] = &[
Expand Down Expand Up @@ -286,7 +286,7 @@ impl TransactionBuilder {
}

/// Assuming everything is resolved, convert this transaction into the
/// resolved form. Returns a [`Transaction`] if successful, or an [`Error`] if not.
/// resolved form. Returns a [`Transaction`] if successful, or an `Error` if not.
pub fn finish(self) -> Result<Transaction, Error> {
let Some(sender) = self.sender else {
return Err(Error::MissingSender);
Expand Down

0 comments on commit 9e4be95

Please sign in to comment.