[][src]Enum netcdf3::DataType

#[repr(u32)]pub enum DataType {
    I8,
    U8,
    I16,
    I32,
    F32,
    F64,
}

All data types supported by the NetCDF-3 format

Example

use netcdf3::{DataType};

assert_eq!("NC_BYTE",   DataType::I8.c_api_name());
assert_eq!("NC_CHAR",   DataType::U8.c_api_name());
assert_eq!("NC_SHORT",  DataType::I16.c_api_name());
assert_eq!("NC_INT",    DataType::I32.c_api_name());
assert_eq!("NC_FLOAT",  DataType::F32.c_api_name());
assert_eq!("NC_DOUBLE", DataType::F64.c_api_name());
 
assert_eq!(1, DataType::I8.size_of());
assert_eq!(1, DataType::U8.size_of());
assert_eq!(2, DataType::I16.size_of());
assert_eq!(4, DataType::I32.size_of());
assert_eq!(4, DataType::F32.size_of());
assert_eq!(8, DataType::F64.size_of());

Variants

I8

8-bit signed integer, a.k.a. NC_BYTE

U8

8-bit character, a.k.a. NC_CHAR

I16

16-bit signed integer, a.k.a. NC_SHORT

I32

32-bit signed integer, a.k.a. NC_INT

F32

32-bit floating-point number, a.k.a. NC_FLOAT

F64

64-bit floating-point number, a.k.a. NC_DOUBLE

Methods

impl DataType[src]

pub fn size_of(&self) -> usize[src]

Returns the size (in bytes) of one element of DataType.

Example

assert_eq!(1, DataType::I8.size_of());
assert_eq!(1, DataType::U8.size_of());
assert_eq!(2, DataType::I16.size_of());
assert_eq!(4, DataType::I32.size_of());
assert_eq!(4, DataType::F32.size_of());
assert_eq!(8, DataType::F64.size_of());

pub fn c_api_name(&self) -> &'static str[src]

Returns the name of the DataType commoly used in the NedCDF C API.

Example

assert_eq!("NC_BYTE", DataType::I8.c_api_name());
assert_eq!("NC_CHAR", DataType::U8.c_api_name());
assert_eq!("NC_SHORT", DataType::I16.c_api_name());
assert_eq!("NC_INT", DataType::I32.c_api_name());
assert_eq!("NC_FLOAT", DataType::F32.c_api_name());
assert_eq!("NC_DOUBLE", DataType::F64.c_api_name());

See also

The NetCDF C-API

Trait Implementations

impl Clone for DataType[src]

impl Debug for DataType[src]

impl Display for DataType[src]

impl Eq for DataType[src]

impl PartialEq<DataType> for DataType[src]

impl StructuralEq for DataType[src]

impl StructuralPartialEq for DataType[src]

impl TryFrom<u32> for DataType[src]

type Error = &'static str

The type returned in the event of a conversion error.

Auto Trait Implementations

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.