mirror of
https://github.com/danog/ext-php-rs.git
synced 2025-01-22 13:01:24 +01:00
Prepared for v0.5.0 release (#79)
- Bumped versions - Updated changelog - Updated docs.rs bindings - Updated documentation about rename methods
This commit is contained in:
parent
afdac8e4b3
commit
1e41b50100
115
CHANGELOG.md
115
CHANGELOG.md
@ -1,32 +1,78 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Version 0.5.0
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
- Method names are now renamed to snake case by default [#63].
|
||||||
|
- Refactored `ZendHashTable` into an owned and borrowed variant [#76].
|
||||||
|
- Creating a new hashtable is done through the `OwnedHashTable` struct, which
|
||||||
|
is then dereferenced to `&HashTable`, as `String` is to `&str`.
|
||||||
|
- Refactored `ZendString` into an owned and borrowed variant [#77].
|
||||||
|
- Creating a new Zend string is done through the `ZendString` struct, which is
|
||||||
|
then dereferenced to `&ZendStr`, as `String` is to `&str`.
|
||||||
|
- Class properties are now defined as struct properties, removing the old
|
||||||
|
property system in the process [#69].
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
- Added interfaces and parent class to the `Debug` implementation for
|
||||||
|
`ClassEntry` [@72b0491].
|
||||||
|
- Rust unit type `()` now has a datatype of `void` [@8b3ed08].
|
||||||
|
- Functions returning Rust objects will now display their full classname in
|
||||||
|
reflection [#64].
|
||||||
|
- Fixed alignment of class objects in memory [#66].
|
||||||
|
|
||||||
|
Thanks to the contributors for this release:
|
||||||
|
|
||||||
|
- @davidcole1340
|
||||||
|
- @vodik
|
||||||
|
|
||||||
|
[#63]: https://github.com/davidcole1340/ext-php-rs/pull/63
|
||||||
|
[#76]: https://github.com/davidcole1340/ext-php-rs/pull/76
|
||||||
|
[#77]: https://github.com/davidcole1340/ext-php-rs/pull/77
|
||||||
|
[#69]: https://github.com/davidcole1340/ext-php-rs/pull/69
|
||||||
|
[#64]: https://github.com/davidcole1340/ext-php-rs/pull/64
|
||||||
|
[#66]: https://github.com/davidcole1340/ext-php-rs/pull/66
|
||||||
|
[@72b0491]: https://github.com/davidcole1340/ext-php-rs/commit/72b0491
|
||||||
|
[@8b3ed08]: https://github.com/davidcole1340/ext-php-rs/commit/8b3ed08
|
||||||
|
|
||||||
|
## Version 0.2.0 - 0.4.0
|
||||||
|
|
||||||
|
- Added macros!
|
||||||
|
- Missed a bit :(
|
||||||
|
|
||||||
## Version 0.1.0
|
## Version 0.1.0
|
||||||
|
|
||||||
- `Zval::reference()` returns a reference instead of a dereferenced pointer.
|
- `Zval::reference()` returns a reference instead of a dereferenced pointer.
|
||||||
- Added `ZendHashTable::iter()` - note this is changing in a future version.
|
- Added `ZendHashTable::iter()` - note this is changing in a future version.
|
||||||
- `ClassBuilder::extends()` now takes a reference rather than a pointer to match the
|
- `ClassBuilder::extends()` now takes a reference rather than a pointer to match
|
||||||
return type of `ClassEntry::exception()`.
|
the return type of `ClassEntry::exception()`.
|
||||||
- `ClassEntry::build()` now returns a reference - same reason as above.
|
- `ClassEntry::build()` now returns a reference - same reason as above.
|
||||||
- Improve library 'safety' by removing `unwrap` calls:
|
- Improve library 'safety' by removing `unwrap` calls:
|
||||||
- `.build()` returns `Result` on `FunctionBuilder`, `ClassBuilder` and `ModuleBuilder`.
|
- `.build()` returns `Result` on `FunctionBuilder`, `ClassBuilder` and
|
||||||
- `.property()` and `.constant()` return `Result` on `ClassBuilder`.
|
`ModuleBuilder`.
|
||||||
- `.register_constant()` returns `Result`.
|
- `.property()` and `.constant()` return `Result` on `ClassBuilder`.
|
||||||
- `.try_call()` on callables now return `Result` rather than `Option`.
|
- `.register_constant()` returns `Result`.
|
||||||
- `throw()` and `throw_with_code()` now returns `Result`.
|
- `.try_call()` on callables now return `Result` rather than `Option`.
|
||||||
- `new()` and `new_interned()` on `ZendString` now returns a `Result`.
|
- `throw()` and `throw_with_code()` now returns `Result`.
|
||||||
- For `ZendHashTable`:
|
- `new()` and `new_interned()` on `ZendString` now returns a `Result`.
|
||||||
- `insert()`, `insert_at_index()` now returns a `Result<HashTableInsertResult>`, where `Err` failed,
|
- For `ZendHashTable`:
|
||||||
`Ok(Ok)` inserts successfully without overwrite, and `Ok(OkWithOverwrite(&Zval))` inserts successfully
|
- `insert()`, `insert_at_index()` now returns a
|
||||||
with overwrite.
|
`Result<HashTableInsertResult>`, where `Err` failed, `Ok(Ok)` inserts
|
||||||
- `push()` now returns a `Result`.
|
successfully without overwrite, and `Ok(OkWithOverwrite(&Zval))` inserts
|
||||||
- Converting from a `Vec` or `HashMap` to a `ZendHashTable` is fallible, so it now implementes `TryFrom` as
|
successfully with overwrite.
|
||||||
opposed to `From`.
|
- `push()` now returns a `Result`.
|
||||||
- For `Zval`:
|
- Converting from a `Vec` or `HashMap` to a `ZendHashTable` is fallible, so
|
||||||
- `set_string()` now returns a `Result`, and takes a second parameter (persistent).
|
it now implementes `TryFrom` as opposed to `From`.
|
||||||
- `set_persistent_string()` has now been removed in favour of `set_string()`.
|
- For `Zval`:
|
||||||
- `set_interned_string()` also returns a `Result`.
|
- `set_string()` now returns a `Result`, and takes a second parameter
|
||||||
- `set_array()` now only takes a `ZendHashTable`, you must convert your `Vec` or `HashMap`
|
(persistent).
|
||||||
by calling `try_into()` and handling the error.
|
- `set_persistent_string()` has now been removed in favour of
|
||||||
|
`set_string()`.
|
||||||
|
- `set_interned_string()` also returns a `Result`.
|
||||||
|
- `set_array()` now only takes a `ZendHashTable`, you must convert your
|
||||||
|
`Vec` or `HashMap` by calling `try_into()` and handling the error.
|
||||||
|
|
||||||
## Version 0.0.7
|
## Version 0.0.7
|
||||||
|
|
||||||
@ -36,19 +82,28 @@ return type of `ClassEntry::exception()`.
|
|||||||
|
|
||||||
## Version 0.0.6
|
## Version 0.0.6
|
||||||
|
|
||||||
- Fixed `panic!` when a PHP binary string was given to a function (@davidcole1340) [c:d73788e]
|
- Fixed `panic!` when a PHP binary string was given to a function
|
||||||
- Fixed memory leak when returning an array from Rust to PHP (@davidcole1340) #34
|
(@davidcole1340) [c:d73788e]
|
||||||
- Documentation is now deployed to [GitHub Pages](https://davidcol1340.github.io/ext-php-rs) (@davidcole1340) #35
|
- Fixed memory leak when returning an array from Rust to PHP (@davidcole1340)
|
||||||
- Added ability to unpack and pack binary strings similar to PHP (@davidcole1340) #32
|
#34
|
||||||
|
- Documentation is now deployed to
|
||||||
|
[GitHub Pages](https://davidcol1340.github.io/ext-php-rs) (@davidcole1340) #35
|
||||||
|
- Added ability to unpack and pack binary strings similar to PHP
|
||||||
|
(@davidcole1340) #32
|
||||||
- Allowed `default-features` to be true for Bindgen (@willbrowningme) #36
|
- Allowed `default-features` to be true for Bindgen (@willbrowningme) #36
|
||||||
|
|
||||||
## Version 0.0.5
|
## Version 0.0.5
|
||||||
|
|
||||||
- Relicensed project under MIT or Apache 2.0 as per Rust crate guidelines (@davidcole1340) [c:439f2ae]
|
- Relicensed project under MIT or Apache 2.0 as per Rust crate guidelines
|
||||||
- Added `parse_args!` macro to simplify argument parsing (@davidcole1340) [c:45c7242]
|
(@davidcole1340) [c:439f2ae]
|
||||||
- Added ability to throw exceptions from Rust to PHP (@davidcole1340) [c:45c7242]
|
- Added `parse_args!` macro to simplify argument parsing (@davidcole1340)
|
||||||
|
[c:45c7242]
|
||||||
|
- Added ability to throw exceptions from Rust to PHP (@davidcole1340)
|
||||||
|
[c:45c7242]
|
||||||
- Added ability to register global constants (@davidcole1340) [c:472e26e]
|
- Added ability to register global constants (@davidcole1340) [c:472e26e]
|
||||||
- Implemented `From<ZendHashTable>` for `Vec` (@davidcole1340) [c:3917c41]
|
- Implemented `From<ZendHashTable>` for `Vec` (@davidcole1340) [c:3917c41]
|
||||||
- Expanded implementations for converting to `Zval` from primitives (@davidcole1340) [c:d4c6aa2]
|
- Expanded implementations for converting to `Zval` from primitives
|
||||||
|
(@davidcole1340) [c:d4c6aa2]
|
||||||
- Replaced unit errors with an `Error` enum (@davidcole1340) [c:f11451f]
|
- Replaced unit errors with an `Error` enum (@davidcole1340) [c:f11451f]
|
||||||
- Added `Debug` and `Clone` implementations for most structs (@davidcole1340) [c:62a43e6]
|
- Added `Debug` and `Clone` implementations for most structs (@davidcole1340)
|
||||||
|
[c:62a43e6]
|
||||||
|
@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs"
|
|||||||
homepage = "https://github.com/davidcole1340/ext-php-rs"
|
homepage = "https://github.com/davidcole1340/ext-php-rs"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
keywords = ["php", "ffi", "zend"]
|
keywords = ["php", "ffi", "zend"]
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
authors = ["David Cole <david.cole1340@gmail.com>"]
|
authors = ["David Cole <david.cole1340@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
categories = ["api-bindings"]
|
categories = ["api-bindings"]
|
||||||
@ -13,12 +13,12 @@ categories = ["api-bindings"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "1.2.1"
|
bitflags = "1.2.1"
|
||||||
parking_lot = "0.11.2"
|
parking_lot = "0.11.2"
|
||||||
ext-php-rs-derive = { version = "=0.4.0", path = "./ext-php-rs-derive" }
|
ext-php-rs-derive = { version = "=0.5.0", path = "./ext-php-rs-derive" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
bindgen = { version = ">= 0.57.0, < 0.58.1" }
|
bindgen = { version = "0.59" }
|
||||||
regex = "1"
|
regex = "1"
|
||||||
cc = "1.0.67"
|
cc = "1.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
alloc = []
|
alloc = []
|
||||||
|
@ -32,6 +32,7 @@ pub const IS_CONSTANT_AST: u32 = 11;
|
|||||||
pub const IS_CALLABLE: u32 = 12;
|
pub const IS_CALLABLE: u32 = 12;
|
||||||
pub const IS_VOID: u32 = 14;
|
pub const IS_VOID: u32 = 14;
|
||||||
pub const IS_MIXED: u32 = 16;
|
pub const IS_MIXED: u32 = 16;
|
||||||
|
pub const IS_PTR: u32 = 13;
|
||||||
pub const _IS_BOOL: u32 = 17;
|
pub const _IS_BOOL: u32 = 17;
|
||||||
pub const Z_TYPE_FLAGS_SHIFT: u32 = 8;
|
pub const Z_TYPE_FLAGS_SHIFT: u32 = 8;
|
||||||
pub const IS_TYPE_REFCOUNTED: u32 = 1;
|
pub const IS_TYPE_REFCOUNTED: u32 = 1;
|
||||||
@ -221,7 +222,6 @@ pub struct _zend_refcounted {
|
|||||||
pub gc: zend_refcounted_h,
|
pub gc: zend_refcounted_h,
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct _zend_string {
|
pub struct _zend_string {
|
||||||
pub gc: zend_refcounted_h,
|
pub gc: zend_refcounted_h,
|
||||||
pub h: zend_ulong,
|
pub h: zend_ulong,
|
||||||
@ -388,6 +388,9 @@ pub struct zend_get_gc_buffer {
|
|||||||
pub end: *mut zval,
|
pub end: *mut zval,
|
||||||
pub start: *mut zval,
|
pub start: *mut zval,
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn zval_ptr_dtor(zval_ptr: *mut zval);
|
||||||
|
}
|
||||||
pub type zend_object_iterator = _zend_object_iterator;
|
pub type zend_object_iterator = _zend_object_iterator;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
@ -4,7 +4,7 @@ description = "Derive macros for ext-php-rs."
|
|||||||
repository = "https://github.com/davidcole1340/ext-php-rs"
|
repository = "https://github.com/davidcole1340/ext-php-rs"
|
||||||
homepage = "https://github.com/davidcole1340/ext-php-rs"
|
homepage = "https://github.com/davidcole1340/ext-php-rs"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
authors = ["David Cole <david.cole1340@gmail.com>"]
|
authors = ["David Cole <david.cole1340@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
@ -17,7 +17,18 @@ methods is they are bounded by their class object.
|
|||||||
Class methods can take a `&self` or `&mut self` parameter. They cannot take a
|
Class methods can take a `&self` or `&mut self` parameter. They cannot take a
|
||||||
consuming `self` parameter. Static methods can omit this `self` parameter.
|
consuming `self` parameter. Static methods can omit this `self` parameter.
|
||||||
|
|
||||||
Options are passed as separate attributes:
|
By default, all methods are renamed in PHP to the camel-case variant of the Rust
|
||||||
|
method name. This can be changed on the `#[php_impl]` attribute, by passing one
|
||||||
|
of the following as the `rename_methods` option:
|
||||||
|
|
||||||
|
- `"none"` - does not rename the methods.
|
||||||
|
- `"camelCase"` - renames all methods to camel case (default).
|
||||||
|
- `"snake_case"` - renames all methods to snake case.
|
||||||
|
|
||||||
|
For example, to disable renaming, change the `#[php_impl]` attribute to
|
||||||
|
`#[php_impl(rename_methods = "none")]`.
|
||||||
|
|
||||||
|
The rest of the options are passed as separate attributes:
|
||||||
|
|
||||||
- `#[defaults(i = 5, b = "hello")]` - Sets the default value for parameter(s).
|
- `#[defaults(i = 5, b = "hello")]` - Sets the default value for parameter(s).
|
||||||
- `#[optional(i)]` - Sets the first optional parameter. Note that this also sets
|
- `#[optional(i)]` - Sets the first optional parameter. Note that this also sets
|
||||||
@ -25,6 +36,8 @@ Options are passed as separate attributes:
|
|||||||
variant of `Option<T>`.
|
variant of `Option<T>`.
|
||||||
- `#[public]`, `#[protected]` and `#[private]` - Sets the visibility of the
|
- `#[public]`, `#[protected]` and `#[private]` - Sets the visibility of the
|
||||||
method.
|
method.
|
||||||
|
- `#[rename("method_name")]` - Renames the PHP method to a different identifier,
|
||||||
|
without renaming the Rust method name.
|
||||||
|
|
||||||
The `#[defaults]` and `#[optional]` attributes operate the same as the
|
The `#[defaults]` and `#[optional]` attributes operate the same as the
|
||||||
equivalent function attribute parameters.
|
equivalent function attribute parameters.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user