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 thechronodate/time types) require the array to hold exactly one element and no nulls; any other length is an error. - Slice /
Vecconversions (&[T]andVec<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
impl DoraArray
Sourcepub fn null_count(&self) -> usize
pub fn null_count(&self) -> usize
The number of null elements in the payload.
Sourcepub fn type_name(&self) -> String
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§
Auto Trait Implementations§
impl !RefUnwindSafe for DoraArray
impl !UnwindSafe for DoraArray
impl Freeze for DoraArray
impl Send for DoraArray
impl Sync for DoraArray
impl Unpin for DoraArray
impl UnsafeUnpin for DoraArray
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request