Skip to main content

AttributeValue

Enum AttributeValue 

Source
pub enum AttributeValue {
    Text(String),
    I8(Vec<i8>),
    U8(Vec<u8>),
    I16(Vec<i16>),
    U16(Vec<u16>),
    I32(Vec<i32>),
    U32(Vec<u32>),
    I64(Vec<i64>),
    U64(Vec<u64>),
    F32(Vec<f32>),
    F64(Vec<f64>),
}
Expand description

Attribute value types supported by NetCDF.

Variants§

§

Text(String)

Text attribute

§

I8(Vec<i8>)

8-bit signed integer

§

U8(Vec<u8>)

8-bit unsigned integer

§

I16(Vec<i16>)

16-bit signed integer

§

U16(Vec<u16>)

16-bit unsigned integer (NetCDF-4 only)

§

I32(Vec<i32>)

32-bit signed integer

§

U32(Vec<u32>)

32-bit unsigned integer (NetCDF-4 only)

§

I64(Vec<i64>)

64-bit signed integer (NetCDF-4 only)

§

U64(Vec<u64>)

64-bit unsigned integer (NetCDF-4 only)

§

F32(Vec<f32>)

32-bit floating point

§

F64(Vec<f64>)

64-bit floating point

Implementations§

Source§

impl AttributeValue

Source

pub fn text(s: impl Into<String>) -> Self

Create a text attribute.

Source

pub fn i8(value: i8) -> Self

Create a single i8 attribute.

Source

pub fn i8_array(values: Vec<i8>) -> Self

Create an i8 array attribute.

Source

pub fn u8(value: u8) -> Self

Create a single u8 attribute.

Source

pub fn u8_array(values: Vec<u8>) -> Self

Create a u8 array attribute.

Source

pub fn i16(value: i16) -> Self

Create a single i16 attribute.

Source

pub fn i16_array(values: Vec<i16>) -> Self

Create an i16 array attribute.

Source

pub fn u16(value: u16) -> Self

Create a single u16 attribute (NetCDF-4 only).

Source

pub fn u16_array(values: Vec<u16>) -> Self

Create a u16 array attribute (NetCDF-4 only).

Source

pub fn i32(value: i32) -> Self

Create a single i32 attribute.

Source

pub fn i32_array(values: Vec<i32>) -> Self

Create an i32 array attribute.

Source

pub fn u32(value: u32) -> Self

Create a single u32 attribute (NetCDF-4 only).

Source

pub fn u32_array(values: Vec<u32>) -> Self

Create a u32 array attribute (NetCDF-4 only).

Source

pub fn i64(value: i64) -> Self

Create a single i64 attribute (NetCDF-4 only).

Source

pub fn i64_array(values: Vec<i64>) -> Self

Create an i64 array attribute (NetCDF-4 only).

Source

pub fn u64(value: u64) -> Self

Create a single u64 attribute (NetCDF-4 only).

Source

pub fn u64_array(values: Vec<u64>) -> Self

Create a u64 array attribute (NetCDF-4 only).

Source

pub fn f32(value: f32) -> Self

Create a single f32 attribute.

Source

pub fn f32_array(values: Vec<f32>) -> Self

Create an f32 array attribute.

Source

pub fn f64(value: f64) -> Self

Create a single f64 attribute.

Source

pub fn f64_array(values: Vec<f64>) -> Self

Create an f64 array attribute.

Source

pub fn as_text(&self) -> Result<&str>

Get as text if possible.

§Errors

Returns error if the attribute is not text.

Source

pub fn as_i32(&self) -> Result<i32>

Get as i32 if possible.

§Errors

Returns error if the attribute is not i32 or has multiple values.

Source

pub fn as_f32(&self) -> Result<f32>

Get as f32 if possible.

§Errors

Returns error if the attribute is not f32 or has multiple values.

Source

pub fn as_f64(&self) -> Result<f64>

Get as f64 if possible.

§Errors

Returns error if the attribute is not f64 or has multiple values.

Source

pub const fn type_name(&self) -> &'static str

Get the type name.

Source

pub fn len(&self) -> usize

Get the number of values.

Source

pub fn is_empty(&self) -> bool

Check if empty.

Trait Implementations§

Source§

impl Clone for AttributeValue

Source§

fn clone(&self) -> AttributeValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AttributeValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AttributeValue

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for AttributeValue

Source§

fn eq(&self, other: &AttributeValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AttributeValue

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AttributeValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,