#[repr(u32)]pub enum DataType {
I8 = 1,
U8 = 2,
I16 = 3,
I32 = 4,
F32 = 5,
F64 = 6,
}Expand description
All the 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 = 1
8-bit signed integer, a.k.a. NC_BYTE
U8 = 2
8-bit character, a.k.a. NC_CHAR
I16 = 3
16-bit signed integer, a.k.a. NC_SHORT
I32 = 4
32-bit signed integer, a.k.a. NC_INT
F32 = 5
32-bit floating-point number, a.k.a. NC_FLOAT
F64 = 6
64-bit floating-point number, a.k.a. NC_DOUBLE
Implementations§
Source§impl DataType
impl DataType
Sourcepub fn size_of(&self) -> usize
pub fn size_of(&self) -> usize
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());Sourcepub fn c_api_name(&self) -> &'static str
pub fn c_api_name(&self) -> &'static str
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 Eq for DataType
impl StructuralPartialEq for DataType
Auto Trait Implementations§
impl Freeze for DataType
impl RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl UnwindSafe for DataType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more