From 9aaaee761d8a3f263b3f6ff7f3b37ddda3f96375 Mon Sep 17 00:00:00 2001 From: Marco Neumann Date: Wed, 26 May 2021 09:23:07 +0200 Subject: [PATCH] allow `SliceableCursor` to be constructed from an `Arc` directly This is backwards-compatible since we change the argument from `Vec` to `impl Into>>` and the following implementations exists in std: - `impl Into for T where U: From` (reverse direction) - `impl From for Arc` (create `Arc` from any type) Furthermore `Arc>` can be passed directly now because the following implementations exists: - `impl From for T` (identity) Closes #368. --- parquet/src/util/cursor.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parquet/src/util/cursor.rs b/parquet/src/util/cursor.rs index bce8383767cf..eaed6c7010e6 100644 --- a/parquet/src/util/cursor.rs +++ b/parquet/src/util/cursor.rs @@ -46,10 +46,11 @@ impl fmt::Debug for SliceableCursor { } impl SliceableCursor { - pub fn new(content: Vec) -> Self { - let size = content.len(); + pub fn new(content: impl Into>>) -> Self { + let inner = content.into(); + let size = inner.len(); SliceableCursor { - inner: Arc::new(content), + inner, start: 0, pos: 0, length: size,