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

Support returning mutable references by using returns #50

Open
audunhalland opened this issue Mar 28, 2024 · 0 comments
Open

Support returning mutable references by using returns #50

audunhalland opened this issue Mar 28, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@audunhalland
Copy link
Owner

audunhalland commented Mar 28, 2024

#49 added support for mutable references from AnswerFn.

Adding support for .returns should be possible, but some technically backwards-incompatible changes are needed.

Accessing the output value of a return responder is done using a method called get_output(&self). To add mutation support it needs another method like get_output_mut(&mut self) and the eval function also needs its own mutable version (eval_mut(&mut Unimock, ..)) to be able to call the new method.

edit: also consider supporting fragile returns, but not 100% sure. Fragile values are more likely to cause problems when used as returns compared to created in answer fns. For example, a cloned Unimock used from another thread won't work.

@audunhalland audunhalland added the enhancement New feature or request label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant