Skip to main content

DoraArray

Struct DoraArray 

Source
pub struct DoraArray(/* private fields */);
Expand description

A dora payload: an Apache Arrow array owned by dora.

DoraArray is the counterpart to IntoArrow: dora node APIs hand received outputs to nodes as DoraArray, which is read back into plain Rust values through its TryFrom<&DoraArray> implementations.

The wrapped Arrow array is private. That is the whole point of the type: it is what lets dora change its internal Arrow major without breaking the 1.x contract. To reach the Arrow array itself, enable the feature naming the major you want — see the crate-level docs.

Two conversion shapes are provided, with different length contracts:

  • Scalar conversions (bool, the primitive integer/float types, String, &str, and the chrono date/time types) require the array to hold exactly one element and no nulls; any other length is an error.
  • Slice / Vec conversions (&[T] and Vec<T> for the primitive types) accept any length but still reject any null values.

§Example

use dora_arrow_convert::{DoraArray, IntoArrow};

// Scalar: a single-element array converts to the value.
let data: DoraArray = 42_u8.into_arrow();
let scalar: u8 = (&data).try_into()?;
assert_eq!(scalar, 42);

// Strings follow the same single-element rule.
let data = "hello".to_string().into_arrow();
let text: String = (&data).try_into()?;
assert_eq!(text, "hello");

// Vec: any length, collected into an owned `Vec`.
let data = vec![1_i32, 2, 3].into_arrow();
let values: Vec<i32> = (&data).try_into()?;
assert_eq!(values, vec![1, 2, 3]);

// A multi-element array cannot be read as a scalar.
let data = vec![1_i32, 2, 3].into_arrow();
let scalar: Result<i32, _> = (&data).try_into();
assert!(scalar.is_err());

Implementations§

Source§

impl DoraArray

Source

pub fn len(&self) -> usize

The number of elements in the payload.

Source

pub fn is_empty(&self) -> bool

Whether the payload holds no elements.

Source

pub fn null_count(&self) -> usize

The number of null elements in the payload.

Source

pub fn type_name(&self) -> String

A human-readable name for the payload’s Arrow type, e.g. "UInt8" or "List(Field { name: \"item\", .. })".

Returned as a String rather than an arrow_schema::DataType so that the ungated surface stays free of Arrow types. Use it for logging and error messages; to actually inspect the type, take the array through a version-gated accessor.

Trait Implementations§

Source§

impl Clone for DoraArray

Source§

fn clone(&self) -> DoraArray

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DoraArray

Source§

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

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

impl IntoArrow for DoraArray

Source§

fn into_arrow(self) -> DoraArray

Convert the data into a dora payload.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [u8]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [u16]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [u32]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [u64]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [i8]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [i16]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [i32]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [i64]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [f16]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [f32]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a [f64]

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<u8>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<u16>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<u32>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<u64>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<i8>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<i16>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<i32>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<i64>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<f16>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<f32>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for Vec<f64>

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a DoraArray> for &'a str

Source§

type Error = Report

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

fn try_from(value: &'a DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for bool

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for u8

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for u16

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for u32

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for u64

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for i8

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for i16

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for i32

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for i64

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for f16

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for f32

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for f64

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for String

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for NaiveDate

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for NaiveTime

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&DoraArray> for NaiveDateTime

Source§

type Error = Report

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

fn try_from(value: &DoraArray) -> Result<Self, Self::Error>

Performs the conversion.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more