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

feat(hugr-core): Unseal and make public the traits HugrInternals and HugrMutInternals #1122

Merged
merged 3 commits into from
May 29, 2024

Conversation

aborgna-q
Copy link
Collaborator

Exposes HugrInternals and HugrMutInternals in hugr_core::hugr::internal (but not in hugr).

Closes #1121

@aborgna-q aborgna-q requested a review from a team as a code owner May 28, 2024 16:31
@aborgna-q aborgna-q requested a review from zrho May 28, 2024 16:31
Copy link
Collaborator

@doug-q doug-q left a comment

Choose a reason for hiding this comment

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

Looks good, just a question on making the internal mod public.

@@ -3,6 +3,7 @@
pub mod hugrmut;

pub(crate) mod ident;
pub mod internal;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does this need to be public? Is it because HugrMut has HugrMutInternals as a super trait? This is a shame.

If it must be public then I think we should not suppress the documentation.

Copy link
Collaborator Author

@aborgna-q aborgna-q May 29, 2024

Choose a reason for hiding this comment

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

Leaving it private creates the same behaviour we currently have, where HugrView/HugrMut can only be implemented locally and the HugrMutInternals methods are inaccessible to other crates.

Since this is an internal crate already, we can export the trait and use it in our other crates that require low-level access to the graph.

It may come useful when further splitting up this crate, but the immediate use is accessing HugrMutInternals::replace_op for low-level rewriting in tket2.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I am confused, I had thought HugrMut was previously private. I will fix the PR title.

Copy link

codecov bot commented May 29, 2024

Codecov Report

Attention: Patch coverage is 67.00000% with 33 lines in your changes are missing coverage. Please review.

Project coverage is 86.78%. Comparing base (c74e124) to head (1e1e369).
Report is 1 commits behind head on main.

Files Patch % Lines
hugr-core/src/hugr/internal.rs 64.51% 31 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1122      +/-   ##
==========================================
+ Coverage   86.73%   86.78%   +0.05%     
==========================================
  Files          90       91       +1     
  Lines       18556    18560       +4     
  Branches    18163    18167       +4     
==========================================
+ Hits        16094    16107      +13     
+ Misses       1615     1606       -9     
  Partials      847      847              
Flag Coverage Δ
rust 86.86% <67.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@doug-q doug-q changed the title feat: Unseal the internal traits feat: Add HugrMut trait May 29, 2024
@doug-q doug-q changed the title feat: Add HugrMut trait feat: Add HugrMut trait in hugr-core May 29, 2024
@doug-q doug-q changed the title feat: Add HugrMut trait in hugr-core feat(hugr-core): Add HugrMut trait May 29, 2024
@doug-q
Copy link
Collaborator

doug-q commented May 29, 2024

I've taken the liberty of editing the commit title to be more interesting in release notes. Please revert if you disagree.

@aborgna-q
Copy link
Collaborator Author

Uhm, I'd rather say it adds HugrMutInternals and HugrInternals.
HugrMut is already public.

@doug-q doug-q changed the title feat(hugr-core): Add HugrMut trait feat(hugr-core): Unseal and make public the traits HugrInternals and HugrInternals May 29, 2024
@doug-q doug-q changed the title feat(hugr-core): Unseal and make public the traits HugrInternals and HugrInternals feat(hugr-core): Unseal and make public the traits HugrInternals and HugrMutInternals May 29, 2024
@aborgna-q aborgna-q added this pull request to the merge queue May 29, 2024
Merged via the queue into main with commit f97ba06 May 29, 2024
17 of 18 checks passed
@aborgna-q aborgna-q deleted the ab/unseal branch May 29, 2024 10:36
@hugrbot hugrbot mentioned this pull request May 29, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 29, 2024
#1122 missed re-exporting some `pub use`s from `hugr_core::hugr`.
@hugrbot hugrbot mentioned this pull request May 29, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 29, 2024
## 🤖 New release
* `hugr`: 0.4.0 -> 0.5.0
* `hugr-cli`: 0.1.0
* `hugr-core`: 0.1.0
* `hugr-passes`: 0.1.0

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr`
<blockquote>

## 0.5.0 (2024-05-29)

### Bug Fixes

- Missing re-exports in `hugr::hugr`
([#1127](#1127))
- Set initial version of hugr-core to 0.1.0
([#1129](#1129))

### Features

- [**breaking**] Remove `PartialEq` impl for `ConstF64`
([#1079](#1079))
- [**breaking**] Allow "Row Variables" declared as List<Type>
([#804](#804))
- Hugr binary cli tool ([#1096](#1096))
- [**breaking**] Move passes from `algorithms` into a separate crate
([#1100](#1100))
- [**breaking**] Disallow nonlocal value edges into FuncDefn's
([#1061](#1061))
- [**breaking**] Move cli in to hugr-cli sub-crate
([#1107](#1107))
- Add verbosity, return `Hugr` from `run`.
([#1116](#1116))
- Unseal and make public the traits `HugrInternals` and
`HugrMutInternals` ([#1122](#1122))

### Refactor

- [**breaking**] No Ports in TypeRow
([#1087](#1087))
- Add a `hugr-core` crate
([#1108](#1108))
</blockquote>

## `hugr-core`
<blockquote>

## 0.1.0 (2024-05-29)

### Bug Fixes

- Set initial version of hugr-core to 0.1.0
([#1129](#1129))

### Features

- [**breaking**] Move cli in to hugr-cli sub-crate
([#1107](#1107))
- Make internals of int ops and the "int" CustomType more public.
([#1114](#1114))
- Unseal and make public the traits `HugrInternals` and
`HugrMutInternals` ([#1122](#1122))

### Refactor

- Add a `hugr-core` crate
([#1108](#1108))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

---------

Co-authored-by: Agustin Borgna <[email protected]>
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.

Expose sealed traits in hugr-core
2 participants