arrow::array::ffi

Struct FFI_ArrowSchema

#[repr(C)]
pub struct FFI_ArrowSchema { format: *const i8, name: *const i8, metadata: *const i8, flags: i64, n_children: i64, children: *mut *mut FFI_ArrowSchema, dictionary: *mut FFI_ArrowSchema, release: Option<unsafe extern "C" fn(_: *mut FFI_ArrowSchema)>, private_data: *mut c_void, }
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()
}

Fields§

§format: *const i8§name: *const i8§metadata: *const i8§flags: i64§n_children: i64§children: *mut *mut FFI_ArrowSchema§dictionary: *mut FFI_ArrowSchema§release: Option<unsafe extern "C" fn(_: *mut FFI_ArrowSchema)>§private_data: *mut c_void

Implementations§

§

impl FFI_ArrowSchema

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

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

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

Set the name of the schema

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

Set the flags of the schema

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

Add metadata to the schema

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

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

pub fn empty() -> FFI_ArrowSchema

Create an empty FFI_ArrowSchema

pub fn format(&self) -> &str

Returns the format of this schema.

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

Returns the name of this schema.

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

Returns the flags of this schema.

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

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.

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

Returns an iterator to the schema’s children.

pub fn nullable(&self) -> bool

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

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

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.

pub fn map_keys_sorted(&self) -> bool

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

Refer to Arrow Flags

pub fn dictionary_ordered(&self) -> bool

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

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

Returns the metadata in the schema as Key-Value pairs

Trait Implementations§

§

impl Debug for FFI_ArrowSchema

§

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

Formats the value using the given formatter. Read more
§

impl Drop for FFI_ArrowSchema

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl TryFrom<&Arc<Field>> for FFI_ArrowSchema

§

type Error = ArrowError

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

fn try_from( value: &Arc<Field>, ) -> Result<FFI_ArrowSchema, <FFI_ArrowSchema as TryFrom<&Arc<Field>>>::Error>

Performs the conversion.
§

impl TryFrom<&DataType> for FFI_ArrowSchema

§

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

§

type Error = ArrowError

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

impl TryFrom<&FFI_ArrowSchema> for DataType

§

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

§

type Error = ArrowError

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

impl TryFrom<&FFI_ArrowSchema> for Field

§

type Error = ArrowError

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

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

Performs the conversion.
§

impl TryFrom<&FFI_ArrowSchema> for Schema

§

type Error = ArrowError

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

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

Performs the conversion.
§

impl TryFrom<&Field> for FFI_ArrowSchema

§

type Error = ArrowError

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

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

Performs the conversion.
§

impl TryFrom<&Schema> for FFI_ArrowSchema

§

type Error = ArrowError

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

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

Performs the conversion.
§

impl TryFrom<DataType> for FFI_ArrowSchema

§

type Error = ArrowError

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

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

Performs the conversion.
§

impl TryFrom<Field> for FFI_ArrowSchema

§

type Error = ArrowError

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

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

Performs the conversion.
§

impl TryFrom<Schema> for FFI_ArrowSchema

§

type Error = ArrowError

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

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

Performs the conversion.
§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for T
where T: Send,