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

Returns a copy of the value.

Since DObject, DArray, and DBytes are references to instances, the resulting Data will point to the same instance as the original.

Returns true if the value is of type DInt or DFloat.

Returns true if the value is of type DInt.

Returns true if the value is of type DFloat.

Returns true if the value is of type DString.

Returns true if the value is of type DBoolean.

Returns true if the value is of type DObject.

Returns true if the value is of type DArray.

Returns true if the value is of type DBytes.

Returns true if the value is of type DNull.

Returns the underlying i64 value, or panics if not DInt.

Returns the underlying f64 value, or panics if not DFloat.

Returns the underlying bool value, or panics if not DBoolean.

Returns the underlying String value, or panics if not DString.

Returns a new DataObject representing the underlying object instance, or panics if not DObject.

Returns a new DataArray representing the underlying array instance, or panics if not DArray.

Returns a new DataBytes representing the underlying byte buffer instance, or panics if not DBytes.

Returns a String representation of the underlying value.

Trait Implementations

Formats the value using the given formatter. Read more

The default for ndata.Data is DNull.

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.