arrow_schema::ffi

Struct FFI_ArrowSchema

Source
#[repr(C)]
pub struct FFI_ArrowSchema { /* private fields */ }
Expand description

ABI-compatible struct for ArrowSchema from C Data Interface See https://arrow.apache.org/docs/format/CDataInterface.html#structure-definitions

fn array_schema(data_type: &DataType) -> FFI_ArrowSchema {
    FFI_ArrowSchema::try_from(data_type).unwrap()
}

Implementations§

Source§

impl FFI_ArrowSchema

Source

pub fn try_new( format: &str, children: Vec<FFI_ArrowSchema>, dictionary: Option<FFI_ArrowSchema>, ) -> Result<Self, ArrowError>

create a new FFI_ArrowSchema. This fails if the fields’ DataType is not supported.

Source

pub fn with_name(self, name: &str) -> Result<Self, ArrowError>

Set the name of the schema

Source

pub fn with_flags(self, flags: Flags) -> Result<Self, ArrowError>

Set the flags of the schema

Source

pub fn with_metadata<I, S>(self, metadata: I) -> Result<Self, ArrowError>
where I: IntoIterator<Item = (S, S)>, S: AsRef<str>,

Add metadata to the schema

Source

pub unsafe fn from_raw(schema: *mut FFI_ArrowSchema) -> Self

Takes ownership of the pointed to FFI_ArrowSchema

This acts to move the data out of schema, setting the release callback to NULL

§Safety
  • schema must be valid for reads and writes
  • schema must be properly aligned
  • schema must point to a properly initialized value of FFI_ArrowSchema
Source

pub fn empty() -> Self

Create an empty FFI_ArrowSchema

Source

pub fn format(&self) -> &str

Returns the format of this schema.

Source

pub fn name(&self) -> Option<&str>

Returns the name of this schema.

Source

pub fn flags(&self) -> Option<Flags>

Returns the flags of this schema.

Source

pub fn child(&self, index: usize) -> &Self

Returns the child of this schema at index.

§Panics

Panics if index is greater than or equal to the number of children.

This is to make sure that the unsafe acces to raw pointer is sound.

Source

pub fn children(&self) -> impl Iterator<Item = &Self>

Returns an iterator to the schema’s children.

Source

pub fn nullable(&self) -> bool

Returns if the field is semantically nullable, regardless of whether it actually has null values.

Source

pub fn dictionary(&self) -> Option<&Self>

Returns the reference to the underlying dictionary of the schema. Check ArrowSchema.dictionary.

This must be Some if the schema represents a dictionary-encoded type, None otherwise.

Source

pub fn map_keys_sorted(&self) -> bool

For map types, returns whether the keys within each map value are sorted.

Refer to Arrow Flags

Source

pub fn dictionary_ordered(&self) -> bool

For dictionary-encoded types, returns whether the ordering of dictionary indices is semantically meaningful.

Source

pub fn metadata(&self) -> Result<HashMap<String, String>, ArrowError>

Returns the metadata in the schema as Key-Value pairs

Trait Implementations§

Source§

impl Debug for FFI_ArrowSchema

Source§

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

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

impl Drop for FFI_ArrowSchema

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl TryFrom<&Arc<Field>> for FFI_ArrowSchema

Source§

type Error = ArrowError

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

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

Performs the conversion.
Source§

impl TryFrom<&DataType> for FFI_ArrowSchema

Source§

fn try_from(dtype: &DataType) -> Result<Self, ArrowError>

Source§

type Error = ArrowError

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

impl TryFrom<&FFI_ArrowSchema> for DataType

Source§

fn try_from(c_schema: &FFI_ArrowSchema) -> Result<Self, ArrowError>

Source§

type Error = ArrowError

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

impl TryFrom<&FFI_ArrowSchema> for Field

Source§

type Error = ArrowError

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

fn try_from(c_schema: &FFI_ArrowSchema) -> Result<Self, ArrowError>

Performs the conversion.
Source§

impl TryFrom<&FFI_ArrowSchema> for Schema

Source§

type Error = ArrowError

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

fn try_from(c_schema: &FFI_ArrowSchema) -> Result<Self, ArrowError>

Performs the conversion.
Source§

impl TryFrom<&Field> for FFI_ArrowSchema

Source§

type Error = ArrowError

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

fn try_from(field: &Field) -> Result<Self, ArrowError>

Performs the conversion.
Source§

impl TryFrom<&Schema> for FFI_ArrowSchema

Source§

type Error = ArrowError

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

fn try_from(schema: &Schema) -> Result<Self, ArrowError>

Performs the conversion.
Source§

impl TryFrom<DataType> for FFI_ArrowSchema

Source§

type Error = ArrowError

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

fn try_from(dtype: DataType) -> Result<Self, ArrowError>

Performs the conversion.
Source§

impl TryFrom<Field> for FFI_ArrowSchema

Source§

type Error = ArrowError

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

fn try_from(field: Field) -> Result<Self, ArrowError>

Performs the conversion.
Source§

impl TryFrom<Schema> for FFI_ArrowSchema

Source§

type Error = ArrowError

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

fn try_from(schema: Schema) -> Result<Self, ArrowError>

Performs the conversion.
Source§

impl Send for FFI_ArrowSchema

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> 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, 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.