Struct jsonnet::JsonVal
[−]
[src]
pub struct JsonVal<'a> { /* fields omitted */ }
Rust wrapper for borrowed libjsonnet JSON values.
See JsonValue
for the owned version.
Methods
impl<'a> JsonVal<'a>
[src]
unsafe fn from_ptr(vm: &'a JsonnetVm, p: *const JsonnetJsonValue) -> Self
Construct a JsonVal
from a pointer returned from a
low-level jsonnet C function.
Safety
It is up to the caller to ensure that p
was indeed allocated
by vm
.
fn as_ptr(&self) -> *const JsonnetJsonValue
Returns the inner pointer to this jsonnet value.
The returned pointer will be valid for as long as self
is.
fn as_str(&self) -> Option<&str>
Returns the value, if it is a string.
fn as_num(&self) -> Option<f64>
Returns the value, if it is a number.
fn as_bool(&self) -> Option<bool>
Returns the value, if it is a bool.
fn as_null(&self) -> Option<()>
Returns Some(())
if the value is null
.