pub struct RowArena {
inner: RefCell<Vec<Vec<u8>>>,
}
Expand description
RowArena
is used to hold on to temporary Row
s for functions like eval
that need to create complex Datum
s but don’t have a Row
to put them in yet.
Fields§
§inner: RefCell<Vec<Vec<u8>>>
Implementations§
source§impl RowArena
impl RowArena
pub fn new() -> Self
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a RowArena
with a hint of how many rows will be created in the arena, to avoid
reallocations of its internal vector.
sourcepub fn reserve(&self, additional: usize)
pub fn reserve(&self, additional: usize)
Does a reserve
on the underlying Vec
. Call this when you expect additional
more datums
to be created in this arena.
sourcepub fn push_bytes<'a>(&'a self, bytes: Vec<u8>) -> &'a [u8] ⓘ
pub fn push_bytes<'a>(&'a self, bytes: Vec<u8>) -> &'a [u8] ⓘ
Take ownership of bytes
for the lifetime of the arena.
sourcepub fn push_string<'a>(&'a self, string: String) -> &'a str
pub fn push_string<'a>(&'a self, string: String) -> &'a str
Take ownership of string
for the lifetime of the arena.
sourcepub fn push_unary_row<'a>(&'a self, row: Row) -> Datum<'a>
pub fn push_unary_row<'a>(&'a self, row: Row) -> Datum<'a>
Take ownership of row
for the lifetime of the arena, returning a
reference to the first datum in the row.
If we had an owned datum type, this method would be much clearer, and
would be called push_owned_datum
.
sourcefn push_unary_row_datum_nested<'a>(&'a self, row: Row) -> DatumNested<'a>
fn push_unary_row_datum_nested<'a>(&'a self, row: Row) -> DatumNested<'a>
Equivalent to push_unary_row
but returns a DatumNested
rather than a
Datum
.
sourcepub fn make_datum<'a, F>(&'a self, f: F) -> Datum<'a>
pub fn make_datum<'a, F>(&'a self, f: F) -> Datum<'a>
Convenience function to make a new Row
containing a single datum, and
take ownership of it for the lifetime of the arena
let arena = RowArena::new();
let datum = arena.make_datum(|packer| {
packer.push_list(&[Datum::String("hello"), Datum::String("world")]);
});
assert_eq!(datum.unwrap_list().iter().collect::<Vec<_>>(), vec![Datum::String("hello"), Datum::String("world")]);
sourcepub fn make_datum_nested<'a, F>(&'a self, f: F) -> DatumNested<'a>
pub fn make_datum_nested<'a, F>(&'a self, f: F) -> DatumNested<'a>
Convenience function identical to make_datum
but instead returns a
DatumNested
.
sourcepub fn try_make_datum<'a, F, E>(&'a self, f: F) -> Result<Datum<'a>, E>
pub fn try_make_datum<'a, F, E>(&'a self, f: F) -> Result<Datum<'a>, E>
Like RowArena::make_datum
, but the provided closure can return an error.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RowArena
impl !RefUnwindSafe for RowArena
impl Send for RowArena
impl !Sync for RowArena
impl Unpin for RowArena
impl UnwindSafe for RowArena
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.