Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/types/zval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ impl Zval {
}
}

/// Creates a null zval
#[must_use]
pub fn null() -> Zval {
let mut zval = Zval::new();
zval.set_null();
zval
}

/// Dereference the zval, if it is a reference.
#[must_use]
pub fn dereference(&self) -> &Self {
Expand Down Expand Up @@ -790,3 +798,18 @@ impl<'a> FromZvalMut<'a> for &'a mut Zval {
Some(zval)
}
}

#[cfg(test)]
#[cfg(feature = "embed")]
mod tests {
use super::*;
use crate::embed::Embed;

#[test]
fn test_zval_null() {
Embed::run(|| {
let zval = Zval::null();
assert!(zval.is_null());
});
}
}
Loading