Struct polars_arrow::array::MutableDictionaryArray

source ·
pub struct MutableDictionaryArray<K: DictionaryKey, M: MutableArray> { /* private fields */ }

Implementations§

source§

impl<K: DictionaryKey, M: MutableArray + Default> MutableDictionaryArray<K, M>

source

pub fn new() -> Self

Creates an empty MutableDictionaryArray.

source§

impl<K: DictionaryKey, M: MutableArray> MutableDictionaryArray<K, M>

source

pub fn try_empty(values: M) -> PolarsResult<Self>

Creates an empty MutableDictionaryArray from a given empty values array.

§Errors

Errors if the array is non-empty.

source

pub fn from_values(values: M) -> PolarsResult<Self>
where M: Indexable, M::Type: Eq + Hash,

Creates an empty MutableDictionaryArray preloaded with a given dictionary of values. Indices associated with those values are automatically assigned based on the order of the values.

§Errors

Errors if there’s more values than the maximum value of K or if values are not unique.

source

pub fn into_empty(self) -> Self

Creates an empty MutableDictionaryArray retaining the same dictionary as the current mutable dictionary array, but with no data. This may come useful when serializing the array into multiple chunks, where there’s a requirement that the dictionary is the same. No copying is performed, the value map is moved over to the new array.

source

pub fn to_empty(&self) -> Self
where M: Clone,

Same as into_empty but clones the inner value map instead of taking full ownership.

source

pub fn push_null(&mut self)

pushes a null value

source

pub fn values(&self) -> &M

returns a reference to the inner values.

source

pub fn into_arc(self) -> Arc<dyn Array>

converts itself into Arc<dyn Array>

source

pub fn into_box(self) -> Box<dyn Array>

converts itself into Box<dyn Array>

source

pub fn reserve(&mut self, additional: usize)

Reserves additional slots.

source

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the MutableDictionaryArray to fit its current length.

source

pub fn keys(&self) -> &MutablePrimitiveArray<K>

Returns the dictionary keys

Trait Implementations§

source§

impl<K: Debug + DictionaryKey, M: Debug + MutableArray> Debug for MutableDictionaryArray<K, M>

source§

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

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

impl<K: DictionaryKey, M: MutableArray + Default> Default for MutableDictionaryArray<K, M>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<K: DictionaryKey, M: MutableArray> From<MutableDictionaryArray<K, M>> for DictionaryArray<K>

source§

fn from(other: MutableDictionaryArray<K, M>) -> Self

Converts to this type from the input type.
source§

impl<K: DictionaryKey, M: 'static + MutableArray> MutableArray for MutableDictionaryArray<K, M>

source§

fn len(&self) -> usize

The length of the array.
source§

fn validity(&self) -> Option<&MutableBitmap>

The optional validity of the array.
source§

fn as_box(&mut self) -> Box<dyn Array>

Convert itself to an (immutable) Array.
source§

fn as_arc(&mut self) -> Arc<dyn Array>

Convert itself to an (immutable) atomically reference counted Array.
source§

fn data_type(&self) -> &ArrowDataType

The ArrowDataType of the array.
source§

fn as_any(&self) -> &dyn Any

Convert to Any, to enable dynamic casting.
source§

fn as_mut_any(&mut self) -> &mut dyn Any

Convert to mutable Any, to enable dynamic casting.
source§

fn push_null(&mut self)

Adds a new null element to the array.
source§

fn reserve(&mut self, additional: usize)

Reserves additional slots to its capacity.
source§

fn shrink_to_fit(&mut self)

Shrink the array to fit its length.
source§

fn is_empty(&self) -> bool

Whether the array is empty.
source§

fn is_valid(&self, index: usize) -> bool

Whether index is valid / set. Read more
source§

impl<K, M, T> TryExtend<Option<T>> for MutableDictionaryArray<K, M>
where K: DictionaryKey, M: MutableArray + Indexable + TryExtend<Option<T>> + TryPush<Option<T>>, T: AsIndexed<M>, M::Type: Eq + Hash,

source§

fn try_extend<II: IntoIterator<Item = Option<T>>>( &mut self, iter: II, ) -> PolarsResult<()>

Fallible version of Extend::extend.
source§

impl<K, M, T> TryPush<Option<T>> for MutableDictionaryArray<K, M>
where K: DictionaryKey, M: MutableArray + Indexable + TryPush<Option<T>>, T: AsIndexed<M>, M::Type: Eq + Hash,

source§

fn try_push(&mut self, item: Option<T>) -> PolarsResult<()>

Tries to push a new element.

Auto Trait Implementations§

§

impl<K, M> Freeze for MutableDictionaryArray<K, M>
where M: Freeze,

§

impl<K, M> RefUnwindSafe for MutableDictionaryArray<K, M>
where M: RefUnwindSafe,

§

impl<K, M> Send for MutableDictionaryArray<K, M>

§

impl<K, M> Sync for MutableDictionaryArray<K, M>

§

impl<K, M> Unpin for MutableDictionaryArray<K, M>
where M: Unpin, K: Unpin,

§

impl<K, M> UnwindSafe for MutableDictionaryArray<K, M>
where M: UnwindSafe, K: UnwindSafe,

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

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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> Allocation for T
where T: RefUnwindSafe + Send + Sync,