Skip to content

Commit 7634f36

Browse files
authored
Chore: use actual type names in vortex-vector (#5167)
Imo this is more readable when using associated types Signed-off-by: Connor Tsui <[email protected]>
1 parent dd22351 commit 7634f36

File tree

16 files changed

+25
-25
lines changed

16 files changed

+25
-25
lines changed

vortex-vector/src/binaryview/vector.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl<T: BinaryViewType> BinaryViewVector<T> {
3838
/// components.
3939
///
4040
/// The caller must uphold all validation that would otherwise be validated by
41-
/// the [safe constructor][Self::try_new].
41+
/// the [safe constructor](Self::try_new).
4242
pub unsafe fn new_unchecked(
4343
views: Buffer<BinaryView>,
4444
buffers: Arc<Box<[ByteBuffer]>>,
@@ -60,8 +60,8 @@ impl<T: BinaryViewType> BinaryViewVector<T> {
6060
///
6161
/// # Errors
6262
///
63-
/// This function will panic if any of the validation checks performed by [`try_new`][Self::try_new]
64-
/// fails.
63+
/// This function will panic if any of the validation checks performed by
64+
/// [`try_new`](Self::try_new) fails.
6565
pub fn new(views: Buffer<BinaryView>, buffers: Arc<Box<[ByteBuffer]>>, validity: Mask) -> Self {
6666
Self::try_new(views, buffers, validity).vortex_expect("Failed to create `BinaryViewVector`")
6767
}
@@ -153,7 +153,7 @@ impl<T: BinaryViewType> VectorOps for BinaryViewVector<T> {
153153
&self.validity
154154
}
155155

156-
fn try_into_mut(self) -> Result<Self::Mutable, Self>
156+
fn try_into_mut(self) -> Result<BinaryViewVectorMut<T>, Self>
157157
where
158158
Self: Sized,
159159
{

vortex-vector/src/binaryview/vector_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<T: BinaryViewType> VectorMutOps for BinaryViewVectorMut<T> {
166166
self.validity.reserve(additional);
167167
}
168168

169-
fn extend_from_vector(&mut self, other: &Self::Immutable) {
169+
fn extend_from_vector(&mut self, other: &BinaryViewVector<T>) {
170170
// Close any existing views into a new buffer
171171
if let Some(open) = self.open_buffer.take() {
172172
self.buffers.push(open.freeze());
@@ -195,7 +195,7 @@ impl<T: BinaryViewType> VectorMutOps for BinaryViewVectorMut<T> {
195195
self.validity.append_n(false, n);
196196
}
197197

198-
fn freeze(mut self) -> Self::Immutable {
198+
fn freeze(mut self) -> BinaryViewVector<T> {
199199
// Freeze all components, close any in-progress views
200200
if let Some(open) = self.open_buffer.take() {
201201
self.buffers.push(open.freeze());

vortex-vector/src/bool/vector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl VectorOps for BoolVector {
8383
&self.validity
8484
}
8585

86-
fn try_into_mut(self) -> Result<Self::Mutable, Self>
86+
fn try_into_mut(self) -> Result<BoolVectorMut, Self>
8787
where
8888
Self: Sized,
8989
{

vortex-vector/src/bool/vector_mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl VectorMutOps for BoolVectorMut {
152152
self.validity.append_n(false, n);
153153
}
154154

155-
fn freeze(self) -> Self::Immutable {
155+
fn freeze(self) -> BoolVector {
156156
BoolVector {
157157
bits: self.bits.freeze(),
158158
validity: self.validity.freeze(),

vortex-vector/src/decimal/generic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<D: NativeDecimalType> VectorOps for DVector<D> {
9797
&self.validity
9898
}
9999

100-
fn try_into_mut(self) -> Result<Self::Mutable, Self>
100+
fn try_into_mut(self) -> Result<DVectorMut<D>, Self>
101101
where
102102
Self: Sized,
103103
{

vortex-vector/src/decimal/generic_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<D: NativeDecimalType> VectorMutOps for DVectorMut<D> {
3131
self.validity.reserve(additional);
3232
}
3333

34-
fn extend_from_vector(&mut self, other: &Self::Immutable) {
34+
fn extend_from_vector(&mut self, other: &DVector<D>) {
3535
self.elements.extend_from_slice(&other.elements);
3636
self.validity.append_mask(other.validity());
3737
}
@@ -41,7 +41,7 @@ impl<D: NativeDecimalType> VectorMutOps for DVectorMut<D> {
4141
self.validity.append_n(false, n);
4242
}
4343

44-
fn freeze(self) -> Self::Immutable {
44+
fn freeze(self) -> DVector<D> {
4545
DVector {
4646
ps: self.ps,
4747
elements: self.elements.freeze(),

vortex-vector/src/decimal/vector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl VectorOps for DecimalVector {
3636
match_each_dvector!(self, |v| { v.validity() })
3737
}
3838

39-
fn try_into_mut(self) -> Result<Self::Mutable, Self>
39+
fn try_into_mut(self) -> Result<DecimalVectorMut, Self>
4040
where
4141
Self: Sized,
4242
{

vortex-vector/src/decimal/vector_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl VectorMutOps for DecimalVectorMut {
3939
match_each_dvector_mut!(self, |d| { d.reserve(additional) })
4040
}
4141

42-
fn extend_from_vector(&mut self, other: &Self::Immutable) {
42+
fn extend_from_vector(&mut self, other: &DecimalVector) {
4343
match (self, other) {
4444
(DecimalVectorMut::D8(s), DecimalVector::D8(o)) => s.extend_from_vector(o),
4545
(DecimalVectorMut::D16(s), DecimalVector::D16(o)) => s.extend_from_vector(o),
@@ -55,7 +55,7 @@ impl VectorMutOps for DecimalVectorMut {
5555
match_each_dvector_mut!(self, |d| { d.append_nulls(n) })
5656
}
5757

58-
fn freeze(self) -> Self::Immutable {
58+
fn freeze(self) -> DecimalVector {
5959
match_each_dvector_mut!(self, |d| { d.freeze().into() })
6060
}
6161

vortex-vector/src/null/vector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl VectorOps for NullVector {
4343
&self.validity
4444
}
4545

46-
fn try_into_mut(self) -> Result<Self::Mutable, Self>
46+
fn try_into_mut(self) -> Result<NullVectorMut, Self>
4747
where
4848
Self: Sized,
4949
{

vortex-vector/src/null/vector_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ impl VectorMutOps for NullVectorMut {
3939
// We do not allocate memory for `NullVector`, so this is a no-op.
4040
}
4141

42-
fn extend_from_vector(&mut self, other: &Self::Immutable) {
42+
fn extend_from_vector(&mut self, other: &NullVector) {
4343
self.len += other.len;
4444
}
4545

4646
fn append_nulls(&mut self, n: usize) {
4747
self.len += n;
4848
}
4949

50-
fn freeze(self) -> Self::Immutable {
50+
fn freeze(self) -> NullVector {
5151
NullVector::new(self.len)
5252
}
5353

0 commit comments

Comments
 (0)