We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Zval::null()
1 parent 2a0d615 commit da9db12Copy full SHA for da9db12
src/types/zval.rs
@@ -54,6 +54,14 @@ impl Zval {
54
}
55
56
57
+ /// Creates a null zval
58
+ #[must_use]
59
+ pub fn null() -> Zval {
60
+ let mut zval = Zval::new();
61
+ zval.set_null();
62
+ zval
63
+ }
64
+
65
/// Dereference the zval, if it is a reference.
66
#[must_use]
67
pub fn dereference(&self) -> &Self {
@@ -790,3 +798,18 @@ impl<'a> FromZvalMut<'a> for &'a mut Zval {
790
798
Some(zval)
791
799
792
800
801
802
+#[cfg(test)]
803
+#[cfg(feature = "embed")]
804
+mod tests {
805
+ use super::*;
806
+ use crate::embed::Embed;
807
808
+ #[test]
809
+ fn test_zval_null() {
810
+ Embed::run(|| {
811
+ let zval = Zval::null();
812
+ assert!(zval.is_null());
813
+ });
814
815
+}
0 commit comments