pub enum Data {
DObject(usize),
DArray(usize),
DBytes(usize),
DString(String),
DBoolean(bool),
DFloat(f64),
DInt(i64),
DNull,
}
Expand description
Represents an NData value
DObject, DArray, and DBytes are considered instances and the clone() function will return a reference to the same instance.
Variants§
DObject(usize)
Represents an existing instance of ndata::dataobject::DataObject, where data_ref is the value of the DataObject’s data_ref field.
let d = Data::DObject(data_ref);
DArray(usize)
Represents an existing instance of ndata::dataobject::DataArray, where data_ref is the value of the DataArray’s data_ref field.
let d = Data::DArray(data_ref);
DBytes(usize)
Represents an existing instance of ndata::dataobject::DataBytes, where data_ref is the value of the DataBytes’s data_ref field.
let d = Data::DBytes(data_ref);
DString(String)
Contains a String value
let d = Data::DString("hello world".to_owned());
DBoolean(bool)
Contains a bool value
let d = Data::DBoolean(true);
DFloat(f64)
Contains an f64 value
let d = Data::DFloat(99.99);
DInt(i64)
Contains an i64 value
let d = Data::DInt(99);
DNull
Contains no value
let d = Data::DNull;
Implementations§
source§impl Data
impl Data
sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true
if the value is of type DBoolean
.
sourcepub fn object(&self) -> DataObject
pub fn object(&self) -> DataObject
Returns a new DataObject
representing the underlying object instance,
or panics if not DObject
.
sourcepub fn array(&self) -> DataArray
pub fn array(&self) -> DataArray
Returns a new DataArray
representing the underlying array instance,
or panics if not DArray
.
sourcepub fn bytes(&self) -> DataBytes
pub fn bytes(&self) -> DataBytes
Returns a new DataBytes
representing the underlying byte buffer instance,
or panics if not DBytes
.