Skip to content

Commit 30e7004

Browse files
committed
Pub ArrayKey and update example
Currently it's not possible to match against the array key, as it's not exported from mod.rs it seems.
1 parent 5415831 commit 30e7004

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/types/array.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,17 @@ impl ZendHashTable {
519519
/// # Example
520520
///
521521
/// ```no_run
522-
/// use ext_php_rs::types::ZendHashTable;
522+
/// use ext_php_rs::types::{ZendHashTable, ArrayKey};
523523
///
524524
/// let mut ht = ZendHashTable::new();
525525
///
526526
/// for (key, val) in ht.iter() {
527-
/// // ^ Index if inserted at an index.
528-
/// // ^ Optional string key, if inserted like a hashtable.
529-
/// // ^ Inserted value.
530-
///
527+
/// match key {
528+
/// ArrayKey::Long(index) => {
529+
/// }
530+
/// ArrayKey::String(key) => {
531+
/// }
532+
/// }
531533
/// dbg!(key, val);
532534
/// }
533535
#[inline]

src/types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod object;
1313
mod string;
1414
mod zval;
1515

16-
pub use array::ZendHashTable;
16+
pub use array::{ZendHashTable, ArrayKey};
1717
pub use callable::ZendCallable;
1818
pub use class_object::ZendClassObject;
1919
pub use iterable::Iterable;

0 commit comments

Comments
 (0)