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

Inheritance for method docs from parent trait #208

Merged
merged 10 commits into from
Feb 6, 2025
Merged

Inheritance for method docs from parent trait #208

merged 10 commits into from
Feb 6, 2025

Conversation

mlange-42
Copy link
Owner

@mlange-42 mlange-42 commented Feb 5, 2025

Allows to transclude method docs from a trait into a struct method:

trait MyTrait:
    fn do_something(self) -> Int:
        """
        A method that returns an integer.

        Returns:
            An arbitrary integer.
        """
        ...

@value
struct MyStruct(MyTrait):
    fn do_something(self) -> Int:
        """See [[.MyTrait]]."""
        return 100

The signature of the method must be the same as in the trait. So aliases can't be used if the trait does not use them.

Fixes #207

@mlange-42 mlange-42 added the feature feature ideas and requests label Feb 5, 2025
@mlange-42 mlange-42 self-assigned this Feb 5, 2025
@coveralls
Copy link

coveralls commented Feb 5, 2025

Pull Request Test Coverage Report for Build 13169748637

Details

  • 149 of 203 (73.4%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.6%) to 72.118%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/document/paths.go 48 49 97.96%
internal/document/processor.go 4 6 66.67%
internal/document/render.go 1 3 33.33%
internal/document/links.go 24 27 88.89%
internal/document/transclude.go 72 118 61.02%
Totals Coverage Status
Change from base Build 13169167303: -0.6%
Covered Lines: 1733
Relevant Lines: 2403

💛 - Coveralls

@mlange-42 mlange-42 marked this pull request as ready for review February 6, 2025 00:10
@mlange-42 mlange-42 merged commit 721626c into main Feb 6, 2025
16 checks passed
@mlange-42 mlange-42 deleted the transcludes branch February 6, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature ideas and requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Inherit" docs from traits
2 participants