Skip to content

Commit

Permalink
Updated Pack::pack_into documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcole1340 committed May 3, 2021
1 parent 30516cd commit 98fa076
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/php/pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@ use crate::bindings::ext_php_rs_zend_string_init;
/// [`pack`]: https://www.php.net/manual/en/function.pack.php
/// [`unpack`]: https://www.php.net/manual/en/function.unpack.php
pub unsafe trait Pack: Sized {
fn pack_into(vec: Vec<Self>) -> *mut ZendString; //{
// unsafe { ext_php_rs_zend_string_init(ptr as *mut i8, vec.len() as _, false) }
// }
/// Packs a given vector into a Zend binary string. Can be passed to PHP and then unpacked
/// using the [`unpack`] function. Note you should probably use the [`set_binary`] method on the
/// [`Zval`] struct instead of this function directly, as there is currently no way to set a
/// [`ZendString`] on a [`Zval`] directly.
///
/// # Parameters
///
/// * `vec` - The vector to pack into a binary string.
///
/// [`unpack`]: https://www.php.net/manual/en/function.unpack.php
/// [`Zval`]: crate::php::types::zval::Zval
/// [`ZendString`]: crate::php::types::string::ZendString
/// [`set_binary`]: crate::php::types::zval::Zval#method.set_binary
fn pack_into(vec: Vec<Self>) -> *mut ZendString;

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

0 comments on commit 98fa076

Please sign in to comment.