pub enum ArrayKey {
Int(i64),
Str(Str),
}Expand description
A PHP array key: an integer or a byte string.
PHP turns canonical decimal integer strings into integer keys
($a["7"] is $a[7], "07" and "-0" stay strings):
ArrayKey::normalize applies that rule. Array stores keys as
given, because some producers (igbinary, object property tables) keep
numeric strings as string keys.
Variants§
Implementations§
Source§impl ArrayKey
impl ArrayKey
Sourcepub fn from_bytes(key: &[u8]) -> Self
pub fn from_bytes(key: &[u8]) -> Self
The key PHP uses for the string offset key ($a["7"] is $a[7]):
ArrayKey::normalize of a copy of key.
use php_std::ArrayKey;
assert_eq!(ArrayKey::from_bytes(b"7"), ArrayKey::Int(7));
assert_eq!(ArrayKey::from_bytes(b"07"), ArrayKey::Str("07".into()));Trait Implementations§
impl Eq for ArrayKey
impl StructuralPartialEq for ArrayKey
Auto Trait Implementations§
impl !Freeze for ArrayKey
impl Forget for ArrayKey
impl Move for ArrayKey
impl RefUnwindSafe for ArrayKey
impl Send for ArrayKey
impl Sync for ArrayKey
impl Unpin for ArrayKey
impl UnsafeUnpin for ArrayKey
impl UnwindSafe for ArrayKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.