File tree Expand file tree Collapse file tree 4 files changed +11
-17
lines changed Expand file tree Collapse file tree 4 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs"
5
5
homepage = " https://github.com/davidcole1340/ext-php-rs"
6
6
license = " MIT OR Apache-2.0"
7
7
keywords = [" php" , " ffi" , " zend" ]
8
- version = " 0.11 .0"
8
+ version = " 0.12 .0"
9
9
authors = [
" David Cole <[email protected] >" ]
10
10
edition = " 2018"
11
11
categories = [" api-bindings" ]
Original file line number Diff line number Diff line change @@ -519,15 +519,17 @@ impl ZendHashTable {
519
519
/// # Example
520
520
///
521
521
/// ```no_run
522
- /// use ext_php_rs::types::ZendHashTable;
522
+ /// use ext_php_rs::types::{ ZendHashTable, ArrayKey} ;
523
523
///
524
524
/// let mut ht = ZendHashTable::new();
525
525
///
526
526
/// 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
+ /// }
531
533
/// dbg!(key, val);
532
534
/// }
533
535
#[ inline]
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ mod object;
13
13
mod string;
14
14
mod zval;
15
15
16
- pub use array:: ZendHashTable ;
16
+ pub use array:: { ArrayKey , ZendHashTable } ;
17
17
pub use callable:: ZendCallable ;
18
18
pub use class_object:: ZendClassObject ;
19
19
pub use iterable:: Iterable ;
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ impl Zval {
95
95
if self . is_double ( ) {
96
96
Some ( unsafe { self . value . dval } )
97
97
} else {
98
- self . long ( ) . map ( |x| x as f64 )
98
+ None
99
99
}
100
100
}
101
101
@@ -114,17 +114,9 @@ impl Zval {
114
114
115
115
/// Returns the value of the zval if it is a string.
116
116
///
117
- /// If the zval does not contain a string, the function will check if it
118
- /// contains a double or a long, and if so it will convert the value to
119
- /// a [`String`] and return it. Don't rely on this logic, as there is
120
- /// potential for this to change to match the output of the [`str()`]
121
- /// function.
122
- ///
123
117
/// [`str()`]: #method.str
124
118
pub fn string ( & self ) -> Option < String > {
125
- self . str ( )
126
- . map ( |s| s. to_string ( ) )
127
- . or_else ( || self . double ( ) . map ( |x| x. to_string ( ) ) )
119
+ self . str ( ) . map ( |s| s. to_string ( ) )
128
120
}
129
121
130
122
/// Returns the value of the zval if it is a string.
You can’t perform that action at this time.
0 commit comments