pub struct ListBuilder<'a> {
parent_state: ParentState<'a>,
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>
§offsets: Vec<usize>
§validate_unique_fields: bool
Implementations§
Source§impl<'a> ListBuilder<'a>
impl<'a> ListBuilder<'a>
Sourcepub fn new(parent_state: ParentState<'a>, validate_unique_fields: bool) -> Self
pub fn new(parent_state: ParentState<'a>, validate_unique_fields: bool) -> Self
Creates a new list builder, nested on top of the given parent state.
Sourcepub fn with_validate_unique_fields(self, validate_unique_fields: bool) -> Self
pub fn with_validate_unique_fields(self, validate_unique_fields: bool) -> Self
Enables unique field key validation for objects created within this list.
Propagates the validation flag to any ObjectBuilder
s created using
ListBuilder::new_object
.
fn parent_state(&mut self) -> (ParentState<'_>, bool)
Sourcepub fn new_object(&mut self) -> ObjectBuilder<'_>
pub fn new_object(&mut self) -> ObjectBuilder<'_>
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.
Sourcepub fn new_list(&mut self) -> ListBuilder<'_>
pub fn new_list(&mut self) -> ListBuilder<'_>
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.
Sourcepub fn append_value<'m, 'd, T: Into<Variant<'m, 'd>>>(&mut self, value: T)
pub fn append_value<'m, 'd, T: Into<Variant<'m, 'd>>>(&mut self, value: T)
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
.
Sourcepub fn try_append_value<'m, 'd, T: Into<Variant<'m, 'd>>>(
&mut self,
value: T,
) -> Result<(), ArrowError>
pub fn try_append_value<'m, 'd, T: Into<Variant<'m, 'd>>>( &mut self, value: T, ) -> Result<(), ArrowError>
Appends a new primitive value to this list
Sourcepub fn append_value_bytes<'m, 'd>(&mut self, value: impl Into<Variant<'m, 'd>>)
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.
Sourcepub fn with_value<'m, 'd, T: Into<Variant<'m, 'd>>>(self, value: T) -> Self
pub fn with_value<'m, 'd, T: Into<Variant<'m, 'd>>>(self, value: T) -> Self
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
.
Sourcepub fn try_with_value<'m, 'd, T: Into<Variant<'m, 'd>>>(
self,
value: T,
) -> Result<Self, ArrowError>
pub fn try_with_value<'m, 'd, T: Into<Variant<'m, 'd>>>( self, value: T, ) -> Result<Self, ArrowError>
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
.
Trait Implementations§
Source§impl<'a> Debug for ListBuilder<'a>
impl<'a> Debug for ListBuilder<'a>
Source§impl VariantBuilderExt for ListBuilder<'_>
impl VariantBuilderExt for ListBuilder<'_>
Source§fn append_value<'m, 'v>(&mut self, value: impl Into<Variant<'m, 'v>>)
fn append_value<'m, 'v>(&mut self, value: impl Into<Variant<'m, 'v>>)
VariantBuilder::append_value
.Source§fn try_new_list(&mut self) -> Result<ListBuilder<'_>, ArrowError>
fn try_new_list(&mut self) -> Result<ListBuilder<'_>, ArrowError>
VariantBuilder::new_list
. Returns an error if
the nested builder cannot be created, see e.g. ObjectBuilder::try_new_list
.Source§fn try_new_object(&mut self) -> Result<ObjectBuilder<'_>, ArrowError>
fn try_new_object(&mut self) -> Result<ObjectBuilder<'_>, ArrowError>
VariantBuilder::new_object
. Returns an error
if the nested builder cannot be created, see e.g. ObjectBuilder::try_new_object
.Source§fn new_list(&mut self) -> ListBuilder<'_>
fn new_list(&mut self) -> ListBuilder<'_>
VariantBuilder::new_list
. Panics if the nested
builder cannot be created, see e.g. ObjectBuilder::new_list
.Source§fn new_object(&mut self) -> ObjectBuilder<'_>
fn new_object(&mut self) -> ObjectBuilder<'_>
VariantBuilder::new_object
. Panics if the
nested builder cannot be created, see e.g. ObjectBuilder::new_object
.