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
.