pub trait Columnar: 'static {
type Container: ContainerBytes + for<'a> Push<&'a Self>;
// Required method
fn into_owned<'a>(other: Ref<'a, Self>) -> Self;
// Provided methods
fn copy_from<'a>(&mut self, other: Ref<'a, Self>)
where Self: Sized { ... }
fn as_columns<'a, I>(selves: I) -> Self::Container
where I: IntoIterator<Item = &'a Self>,
Self: 'a { ... }
fn into_columns<I>(selves: I) -> Self::Container
where I: IntoIterator<Item = Self>,
Self: Sized { ... }
fn reborrow<'b, 'a: 'b>(thing: Ref<'a, Self>) -> Ref<'b, Self> { ... }
}
Expand description
A type that can be represented in columnar form.
For a running example, a type like (A, Vec<B>)
.
Required Associated Types§
Sourcetype Container: ContainerBytes + for<'a> Push<&'a Self>
type Container: ContainerBytes + for<'a> Push<&'a Self>
The type that stores the columnar representation.
The container must support pushing both &Self
and Self::Ref<'_>
.
In our running example this might be (Vec<A>, Vecs<Vec<B>>)
.
Required Methods§
Sourcefn into_owned<'a>(other: Ref<'a, Self>) -> Self
fn into_owned<'a>(other: Ref<'a, Self>) -> Self
Produce an instance of Self
from Self::Ref<'a>
.
Provided Methods§
Sourcefn copy_from<'a>(&mut self, other: Ref<'a, Self>)where
Self: Sized,
fn copy_from<'a>(&mut self, other: Ref<'a, Self>)where
Self: Sized,
Repopulates self
from a reference.
By default this just calls into_owned()
, but it can be overridden.
Sourcefn as_columns<'a, I>(selves: I) -> Self::Containerwhere
I: IntoIterator<Item = &'a Self>,
Self: 'a,
fn as_columns<'a, I>(selves: I) -> Self::Containerwhere
I: IntoIterator<Item = &'a Self>,
Self: 'a,
Converts a sequence of the references to the type into columnar form.
Sourcefn into_columns<I>(selves: I) -> Self::Containerwhere
I: IntoIterator<Item = Self>,
Self: Sized,
fn into_columns<I>(selves: I) -> Self::Containerwhere
I: IntoIterator<Item = Self>,
Self: Sized,
Converts a sequence of the type into columnar form.
This consumes the owned Self
types but uses them only by reference.
Consider as_columns()
instead if it is equally ergonomic.
Sourcefn reborrow<'b, 'a: 'b>(thing: Ref<'a, Self>) -> Ref<'b, Self>
fn reborrow<'b, 'a: 'b>(thing: Ref<'a, Self>) -> Ref<'b, Self>
Reborrows the reference type to a shorter lifetime.
Implementations must not change the contents of the reference, and should mark
the function as #[inline(always)]
. It is no-op to overcome limitations
of the borrow checker. In many cases, it is enough to return thing
as-is.
For example, when comparing two references Ref<'a>
and Ref<'b>
, we can
reborrow both to a local lifetime to compare them. This allows us to keep the
lifetimes 'a
and 'b
separate, while otherwise Rust would unify them.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.