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(corelib): FnSnapshotImpl #6992

Merged
merged 2 commits into from
Jan 6, 2025
Merged

Conversation

julio4
Copy link
Contributor

@julio4 julio4 commented Jan 4, 2025

This implementation allows to use snapshot of type that implements Fn.
It is useful when we want to pass an @Fn to a function that expects an FnOnce for example.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @julio4)


corelib/src/ops/function.cairo line 40 at r1 (raw file):

/// Implementation of `Fn` for snapshots.
/// This allows using a snapshot of a type that implements `Fn` as a function.
impl FnSnapshotImpl<T, Args, impl F: Fn<T, Args>> of Fn<@T, Args> {

add a minimal test that now works and previously did not at:
corelib/src/test/language_features/closure_test.cairo

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @julio4)


a discussion (no related file):
@TomerStarkware for 2nd eye.

Copy link
Contributor Author

@julio4 julio4 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @orizi)


corelib/src/ops/function.cairo line 40 at r1 (raw file):

Previously, orizi wrote…

add a minimal test that now works and previously did not at:
corelib/src/test/language_features/closure_test.cairo

Done.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @julio4)

Copy link
Collaborator

@TomerStarkware TomerStarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @julio4)

@orizi orizi added this pull request to the merge queue Jan 6, 2025
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @julio4)

Merged via the queue into starkware-libs:main with commit 7d70b26 Jan 6, 2025
47 checks passed
@julio4 julio4 deleted the feat/FnSnapshotImpl branch January 6, 2025 08:22
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.

4 participants