ListBuilder

Struct ListBuilder 

pub struct ListBuilder<'a, S>{
    parent_state: ParentState<'a, S>,
    offsets: Vec<usize>,
    validate_unique_fields: bool,
}
Expand description

A builder for creating Variant::List values.

See the examples on VariantBuilder for usage.

Fields§

§parent_state: ParentState<'a, S>§offsets: Vec<usize>§validate_unique_fields: bool

Implementations§

§

impl<'a, S> ListBuilder<'a, S>

pub fn new( parent_state: ParentState<'a, S>, validate_unique_fields: bool, ) -> ListBuilder<'a, S>

Creates a new list builder, nested on top of the given parent state.

pub fn with_validate_unique_fields( self, validate_unique_fields: bool, ) -> ListBuilder<'a, S>

Enables unique field key validation for objects created within this list.

Propagates the validation flag to any ObjectBuilders created using ListBuilder::new_object.

pub fn new_object(&mut self) -> ObjectBuilder<'_, ListState<'_>>

Returns an object builder that can be used to append a new (nested) object to this list.

WARNING: The builder will have no effect unless/until ObjectBuilder::finish is called.

pub fn new_list(&mut self) -> ListBuilder<'_, ListState<'_>>

Returns a list builder that can be used to append a new (nested) list to this list.

WARNING: The builder will have no effect unless/until ListBuilder::finish is called.

pub fn append_value<'m, 'd, T>(&mut self, value: T)
where T: Into<Variant<'m, 'd>>,

Appends a variant to the list.

§Panics

This method will panic if the variant contains duplicate field names in objects when validation is enabled. For a fallible version, use ListBuilder::try_append_value.

pub fn try_append_value<'m, 'd, T>( &mut self, value: T, ) -> Result<(), ArrowError>
where T: Into<Variant<'m, 'd>>,

Appends a new primitive value to this list

pub fn append_value_bytes<'m, 'd>(&mut self, value: impl Into<Variant<'m, 'd>>)

Appends a variant value to this list by copying raw bytes when possible.

For objects and lists, this directly copies their underlying byte representation instead of performing a logical copy. For other variant types, this falls back to the standard append behavior.

The caller must ensure that the metadata dictionary is already built and correct for any objects or lists being appended.

pub fn with_value<'m, 'd, T>(self, value: T) -> ListBuilder<'a, S>
where T: Into<Variant<'m, 'd>>,

Builder-style API for appending a value to the list and returning self to enable method chaining.

§Panics

This method will panic if the variant contains duplicate field names in objects when validation is enabled. For a fallible version, use ListBuilder::try_with_value.

pub fn try_with_value<'m, 'd, T>( self, value: T, ) -> Result<ListBuilder<'a, S>, ArrowError>
where T: Into<Variant<'m, 'd>>,

Builder-style API for appending a value to the list and returns self for method chaining.

This is the fallible version of ListBuilder::with_value.

pub fn finish(self)

Finalizes this list and appends it to its parent, which otherwise remains unmodified.

Trait Implementations§

§

impl<'a, S> Debug for ListBuilder<'a, S>

§

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

Formats the value using the given formatter. Read more
§

impl<'a, S> VariantBuilderExt for ListBuilder<'a, S>

§

fn append_null(&mut self)

Variant arrays cannot encode NULL values, only Variant::Null.

§

type State<'s> = ListState<'s> where ListBuilder<'a, S>: 's

The builder specific state used by nested builders
§

fn append_value<'m, 'v>(&mut self, value: impl Into<Variant<'m, 'v>>)

Appends a new variant value to this builder. See e.g. VariantBuilder::append_value.
§

fn try_new_list( &mut self, ) -> Result<ListBuilder<'_, <ListBuilder<'a, S> as VariantBuilderExt>::State<'_>>, ArrowError>

Creates a nested list builder. See e.g. VariantBuilder::new_list. Returns an error if the nested builder cannot be created, see e.g. ObjectBuilder::try_new_list.
§

fn try_new_object( &mut self, ) -> Result<ObjectBuilder<'_, <ListBuilder<'a, S> as VariantBuilderExt>::State<'_>>, ArrowError>

Creates a nested object builder. See e.g. VariantBuilder::new_object. Returns an error if the nested builder cannot be created, see e.g. ObjectBuilder::try_new_object.
§

fn new_list(&mut self) -> ListBuilder<'_, Self::State<'_>>

Creates a nested list builder. See e.g. VariantBuilder::new_list. Panics if the nested builder cannot be created, see e.g. ObjectBuilder::new_list.
§

fn new_object(&mut self) -> ObjectBuilder<'_, Self::State<'_>>

Creates a nested object builder. See e.g. VariantBuilder::new_object. Panics if the nested builder cannot be created, see e.g. ObjectBuilder::new_object.

Auto Trait Implementations§

§

impl<'a, S> Freeze for ListBuilder<'a, S>
where S: Freeze,

§

impl<'a, S> !RefUnwindSafe for ListBuilder<'a, S>

§

impl<'a, S> !Send for ListBuilder<'a, S>

§

impl<'a, S> !Sync for ListBuilder<'a, S>

§

impl<'a, S> Unpin for ListBuilder<'a, S>
where S: Unpin,

§

impl<'a, S> !UnwindSafe for ListBuilder<'a, S>

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
§

impl<T> JsonToVariant for T

§

fn append_json(&mut self, json: &str) -> Result<(), ArrowError>

Create a Variant from a JSON string
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> ErasedDestructor for T
where T: 'static,