Struct jsonnet::JsonVal[][src]

pub struct JsonVal<'a> { /* fields omitted */ }

Rust wrapper for borrowed libjsonnet JSON values.

See JsonValue for the owned version.

Implementations

impl<'a> JsonVal<'a>[src]

pub unsafe fn from_ptr(vm: &'a JsonnetVm, p: *const JsonnetJsonValue) -> Self[src]

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.

pub fn as_ptr(&self) -> *const JsonnetJsonValue[src]

Returns the inner pointer to this jsonnet value.

The returned pointer will be valid for as long as self is.

pub fn as_str(&self) -> Option<&str>[src]

Returns the value, if it is a string.

pub fn as_num(&self) -> Option<f64>[src]

Returns the value, if it is a number.

pub fn as_bool(&self) -> Option<bool>[src]

Returns the value, if it is a bool.

pub fn as_null(&self) -> Option<()>[src]

Returns Some(()) if the value is null.

Auto Trait Implementations

impl<'a> RefUnwindSafe for JsonVal<'a>[src]

impl<'a> !Send for JsonVal<'a>[src]

impl<'a> !Sync for JsonVal<'a>[src]

impl<'a> Unpin for JsonVal<'a>[src]

impl<'a> UnwindSafe for JsonVal<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.