Skip to content

Commit 6128168

Browse files
committed
Updated Pack::pack_into documentation
1 parent 1a5d286 commit 6128168

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/php/pack.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,20 @@ use crate::bindings::ext_php_rs_zend_string_init;
1818
/// [`pack`]: https://www.php.net/manual/en/function.pack.php
1919
/// [`unpack`]: https://www.php.net/manual/en/function.unpack.php
2020
pub unsafe trait Pack: Sized {
21-
fn pack_into(vec: Vec<Self>) -> *mut ZendString; //{
22-
// unsafe { ext_php_rs_zend_string_init(ptr as *mut i8, vec.len() as _, false) }
23-
// }
21+
/// Packs a given vector into a Zend binary string. Can be passed to PHP and then unpacked
22+
/// using the [`unpack`] function. Note you should probably use the [`set_binary`] method on the
23+
/// [`Zval`] struct instead of this function directly, as there is currently no way to set a
24+
/// [`ZendString`] on a [`Zval`] directly.
25+
///
26+
/// # Parameters
27+
///
28+
/// * `vec` - The vector to pack into a binary string.
29+
///
30+
/// [`unpack`]: https://www.php.net/manual/en/function.unpack.php
31+
/// [`Zval`]: crate::php::types::zval::Zval
32+
/// [`ZendString`]: crate::php::types::string::ZendString
33+
/// [`set_binary`]: crate::php::types::zval::Zval#method.set_binary
34+
fn pack_into(vec: Vec<Self>) -> *mut ZendString;
2435

2536
/// Unpacks a given Zend binary string into a Rust vector. Can be used to pass data from `pack`
2637
/// in PHP to Rust without encoding into another format. Note that the data *must* be all one

0 commit comments

Comments
 (0)