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

[scarb-doc] Add initial crate structures #1309

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drknzz
Copy link
Member

@drknzz drknzz commented May 14, 2024

Next PR will add nested attributes to the structures:

  • struct members
  • enum variants
  • impl items
  • trait items

@drknzz drknzz requested a review from Arcticae May 14, 2024 09:03
@drknzz drknzz marked this pull request as ready for review May 14, 2024 10:18
@drknzz drknzz requested a review from maciektr as a code owner May 14, 2024 10:18
crate_roots: dependencies,
crates_config,
},
fn print_module(module: &types::Module) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that it's for testing mainly, but this should be implemented via Display nonetheless

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also feel like sub-structs could also have Displays and so on...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but there's a good chance it'll be removed soon anyway so I didn't bother D; (as you've mentioned it's only for testing)

const LIB_TARGET_KIND: &str = "lib";
const CORELIB_CRATE_NAME: &str = "core";

pub fn get_project_config(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were just moved, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly yes, some slight refactor changes

Comment on lines +141 to +143
pub definition: String,

pub text: String,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between those two?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It differs for item types but for example, a free function's definition is its signature while text is the whole function

}

#[derive(Clone, Debug)]
pub struct Constant {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like all of those defs + impls are repetitive and could be done with a macro with like 3 input vars (pointer type, module type and the ModuleItemId)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ikr, but they are planned to change and have some separate attributes, so I kept them like this for now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick]: Those types are really nice, but i would try to give them each a docstring, for an example code snippet that they represent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants