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

[Docs]: Make Rust docs consistent #476

Open
1 task done
bidzyyys opened this issue Jan 7, 2025 · 4 comments · May be fixed by #497
Open
1 task done

[Docs]: Make Rust docs consistent #476

bidzyyys opened this issue Jan 7, 2025 · 4 comments · May be fixed by #497
Assignees
Labels
needs triage Needs to be assigned the appropriate labels type: feature New feature request.

Comments

@bidzyyys
Copy link
Collaborator

bidzyyys commented Jan 7, 2025

What is the feature you would like to see?

Rust docs for our contracts should follow the order:

  1. General information about the function
    1.1 Additional NOTE: ...
    1.2 Additional NOTE: "In order to expose this function in ABI you need to ..."
  2. Arguments (listed with *)
  3. Errors (listed with *)
  4. Panics (listed with *)
  5. Example (if 1.2 exists)

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines
@bidzyyys bidzyyys added type: feature New feature request. needs triage Needs to be assigned the appropriate labels labels Jan 7, 2025
@bidzyyys bidzyyys added this to the Release v0.2.0 milestone Jan 7, 2025
@0xNeshi
Copy link
Collaborator

0xNeshi commented Jan 8, 2025

Just for clarity, with the proposed convention the Erc721::token_uri docs would look like below?

    /// Returns the Uniform Resource Identifier (URI) for `token_id` token.
    ///
    /// NOTE: In order to expose this function in the ABI, you need to annotate
    /// it with `#[selector(name = "tokenURI")]` and ensure that the `erc721`
    /// parameter is passed internally. This design works around Stylus's lack
    /// of inheritance while avoiding code duplication. See the Example section.
    ///
    /// # Arguments
    ///
    /// * `&self` - Read access to the contract's state.
    /// * `token_id` - ID of a token.
    /// * `erc721` - Read access to a contract providing [`IErc721`] interface.
    ///
    /// # Errors
    ///
    /// * [`Error::NonexistentToken`] - If the token does not exist.
    ///
    /// # Example
    ///
    /// ```rust,ignore
    /// #[selector(name = "tokenURI")]
    /// pub fn token_uri(&self, token_id: U256) -> Result<String, Vec<u8>> {
    ///     Ok(self.metadata.token_uri(token_id, &self.erc721)?)
    /// }
    /// ```

@bidzyyys
Copy link
Collaborator Author

bidzyyys commented Jan 8, 2025

Yes @0xNeshi 💯

@DarkLord017
Copy link
Contributor

Hey @0xNeshi ,Would like to work on this

@bidzyyys
Copy link
Collaborator Author

Thanks for your interest in contributing to our library @DarkLord017! Sure, go ahead 🚀

@bidzyyys bidzyyys moved this from Todo to In Progress in Rust Contracts Stylus Jan 14, 2025
DarkLord017 added a commit to DarkLord017/rust-contracts-stylus that referenced this issue Jan 15, 2025
@DarkLord017 DarkLord017 linked a pull request Jan 15, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Needs to be assigned the appropriate labels type: feature New feature request.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants