Enum npyz::DType[][src]

pub enum DType {
    Plain(TypeStr),
    Array(u64Box<DType>),
    Record(Vec<Field>),
}
Expand description

Representation of a Numpy type

Variants

Plain(TypeStr)

Numpy type string. First character is '>' for big endian, '<' for little endian, or can be '|' if it doesn’t matter.

Examples: >i4, <u8, >f8, |S7. The number usually corresponds to the number of bytes (with the single exception of unicode strings |U3).

Array(u64Box<DType>)

Fixed-size inner array type.

This is only possible inside structured arrays, where fields can themselves be arrays. E.g. in the DType for dtype=[('abc', 'i4', [2, 3])], the DType for abc will be Array(2, Array(3, Plain("<i4"))). In rust, such an array could be read using the following element type:

#[derive(npyz::Serialize, npyz::Deserialize, npyz::AutoSerialize)]
struct Row {
    abc: [[i32; 3]; 2],
}
Record(Vec<Field>)

A structure record array

Implementations

Numpy format description of record dtype.

Calling descr on DType::Array will not produce a valid python expression (the string will only be suitable for error messages).

Construct a scalar DType. (one which is not a nested array or record type)

Get the number of bytes that each item of this type occupies.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

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.