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

refactor: simplify json encoding using t2op #78

Merged
merged 2 commits into from
Sep 4, 2023
Merged

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Sep 4, 2023

No description provided.

Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

👍

src/json/op.rs Outdated
Comment on lines 218 to 220
_ => {
return Err(err());
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
_ => {
return Err(err());
}
_ => return Err(err()),

#[derive(Debug, Error, PartialEq, Clone, Copy)]
#[error("Not a T2Op.")]
pub struct NotT2Op;

// this trait could be implemented in Hugr
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// this trait could be implemented in Hugr

not anymore

Copy link
Member Author

Choose a reason for hiding this comment

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

made more generic so that this remains true hopefully

src/ops.rs Outdated
ExternalOp::Extension(e) => Self::try_from_op_def(e.def()),
ExternalOp::Opaque(o) => from_extension_name(o.extension(), o.name()),
}
.map_err(|_| "not a T2Op"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use NotT2Op as the TryFrom error?

@ss2165 ss2165 merged commit 22d3ad1 into main Sep 4, 2023
7 checks passed
@ss2165 ss2165 deleted the refactor/json-t2op branch September 4, 2023 12:35
ss2165 added a commit that referenced this pull request Sep 4, 2023
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.

2 participants