Struct re_sdk::external::arrow2::array::MutableDictionaryArray
pub struct MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray,{
data_type: DataType,
map: ValueMap<K, M>,
keys: MutablePrimitiveArray<K>,
}
Expand description
A mutable, strong-typed version of DictionaryArray
.
§Example
Building a UTF8 dictionary with i32
keys.
let mut array: MutableDictionaryArray<i32, MutableUtf8Array<i32>> = MutableDictionaryArray::new();
array.try_push(Some("A"))?;
array.try_push(Some("B"))?;
array.push_null();
array.try_push(Some("C"))?;
Fields§
§data_type: DataType
§map: ValueMap<K, M>
§keys: MutablePrimitiveArray<K>
Implementations§
§impl<K, M> MutableDictionaryArray<K, M>
impl<K, M> MutableDictionaryArray<K, M>
pub fn new() -> MutableDictionaryArray<K, M>
pub fn new() -> MutableDictionaryArray<K, M>
Creates an empty MutableDictionaryArray
.
§impl<K, M> MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray,
impl<K, M> MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray,
pub fn try_empty(values: M) -> Result<MutableDictionaryArray<K, M>, Error>
pub fn try_empty(values: M) -> Result<MutableDictionaryArray<K, M>, Error>
Creates an empty MutableDictionaryArray
from a given empty values array.
§Errors
Errors if the array is non-empty.
pub fn from_values(values: M) -> Result<MutableDictionaryArray<K, M>, Error>
pub fn from_values(values: M) -> Result<MutableDictionaryArray<K, M>, Error>
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.
pub fn into_empty(self) -> MutableDictionaryArray<K, M>
pub fn into_empty(self) -> MutableDictionaryArray<K, M>
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.
pub fn to_empty(&self) -> MutableDictionaryArray<K, M>where
M: Clone,
pub fn to_empty(&self) -> MutableDictionaryArray<K, M>where
M: Clone,
Same as into_empty
but clones the inner value map instead of taking full ownership.
pub fn push_null(&mut self)
pub fn push_null(&mut self)
pushes a null value
pub fn into_arc(self) -> Arc<dyn Array>
pub fn into_arc(self) -> Arc<dyn Array>
converts itself into Arc<dyn Array>
pub fn into_box(self) -> Box<dyn Array>
pub fn into_box(self) -> Box<dyn Array>
converts itself into Box<dyn Array>
pub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableDictionaryArray
to fit its current length.
pub fn keys(&self) -> &MutablePrimitiveArray<K>
pub fn keys(&self) -> &MutablePrimitiveArray<K>
Returns the dictionary keys
Trait Implementations§
§impl<K, M> Debug for MutableDictionaryArray<K, M>
impl<K, M> Debug for MutableDictionaryArray<K, M>
§impl<K, M> Default for MutableDictionaryArray<K, M>
impl<K, M> Default for MutableDictionaryArray<K, M>
§fn default() -> MutableDictionaryArray<K, M>
fn default() -> MutableDictionaryArray<K, M>
§impl<K, M> From<MutableDictionaryArray<K, M>> for DictionaryArray<K>where
K: DictionaryKey,
M: MutableArray,
impl<K, M> From<MutableDictionaryArray<K, M>> for DictionaryArray<K>where
K: DictionaryKey,
M: MutableArray,
§fn from(other: MutableDictionaryArray<K, M>) -> DictionaryArray<K>
fn from(other: MutableDictionaryArray<K, M>) -> DictionaryArray<K>
§impl<K, M> MutableArray for MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: 'static + MutableArray,
impl<K, M> MutableArray for MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: 'static + MutableArray,
§fn validity(&self) -> Option<&MutableBitmap>
fn validity(&self) -> Option<&MutableBitmap>
§fn as_arc(&mut self) -> Arc<dyn Array>
fn as_arc(&mut self) -> Arc<dyn Array>
Array
.§fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
Any
, to enable dynamic casting.§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
§impl<K, M, T> TryExtend<Option<T>> for MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray + Indexable + TryExtend<Option<T>>,
T: AsIndexed<M>,
<M as Indexable>::Type: Eq + Hash,
impl<K, M, T> TryExtend<Option<T>> for MutableDictionaryArray<K, M>where
K: DictionaryKey,
M: MutableArray + Indexable + TryExtend<Option<T>>,
T: AsIndexed<M>,
<M as Indexable>::Type: Eq + Hash,
§fn try_extend<II>(&mut self, iter: II) -> Result<(), Error>where
II: IntoIterator<Item = Option<T>>,
fn try_extend<II>(&mut self, iter: II) -> Result<(), Error>where
II: IntoIterator<Item = Option<T>>,
Extend::extend
.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>
impl<K, M> UnwindSafe for MutableDictionaryArray<K, M>where
M: UnwindSafe,
K: UnwindSafe,
Blanket Implementations§
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more