Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously because of how mutably borrowing works in Rust, it wasn't (safely) possible to create an
ArgParser
as well as retrieve a reference to$this
. This has been changed, and theArgParser
is now created by the execution data, returning the parser as well as a reference to$this
.Along with these changes, an
Arg
now stores a mutable zval reference. This shouldn't be a huge change sinceArg
is generally defined as mutable to be passed toArgParser
. This has allowed us to add two new traits:FromZvalMut
andFromZendObjectMut
, similar toFromZval
andFromZendObject
except that a mutable zval is provided, allowing us to extract mutable references to objects. If a type hasFromZval
implemented, thenFromZvalMut
is automatically implemented. The same goes forFromZendObject
.Since specialisation is not stabilised in Rust, the
From{Zval, ZendObject}[Mut]
andInto{Zval, ZendObject}
traits cannot be generically implemented for types that implementRegisteredClass
, as this collides withimpl<T> FromZendObjectMut for T where T: FromZendObject
. These implementations have been moved into the downstream extension crates, implemented using theclass_derives!
macro (which is automatically used on classes).Closures can no longer be passed types that reference the zval, as it is consumed. Not sure why this happens, but had to use
Zval::consume
instead as lifetimes weren't being met.