From 48ed3992ddb575534c3db930b2ab2355c5a319ef Mon Sep 17 00:00:00 2001 From: "Jorge C. Leitao" Date: Thu, 30 Sep 2021 14:59:31 +0000 Subject: [PATCH] Added more API docs. --- src/compute/aggregate/mod.rs | 1 + src/compute/aggregate/sum.rs | 2 ++ src/compute/boolean.rs | 18 +----------------- src/compute/boolean_kleene.rs | 1 + src/compute/cast/binary_to.rs | 2 ++ src/compute/cast/mod.rs | 17 +---------------- src/compute/cast/primitive_to.rs | 11 +++++++++++ src/compute/cast/utf8_to.rs | 2 ++ src/compute/comparison/mod.rs | 6 ++++++ src/compute/comparison/simd/mod.rs | 10 ++++++++++ src/compute/contains.rs | 18 ++---------------- src/compute/filter.rs | 18 +----------------- src/compute/hash.rs | 5 +++-- src/compute/if_then_else.rs | 1 + src/compute/like.rs | 27 +++++++++++++++++++++++++++ src/compute/limit.rs | 19 ++----------------- src/compute/merge_sort/mod.rs | 4 ++-- src/compute/nullif.rs | 1 + src/compute/regex_match.rs | 18 ++---------------- src/compute/sort/lex_sort.rs | 2 ++ src/compute/sort/mod.rs | 1 + src/compute/take/mod.rs | 2 ++ src/temporal_conversions.rs | 1 + src/types/mod.rs | 4 ++++ src/types/simd/mod.rs | 2 ++ src/types/simd/native.rs | 1 + 26 files changed, 91 insertions(+), 103 deletions(-) diff --git a/src/compute/aggregate/mod.rs b/src/compute/aggregate/mod.rs index 36f37340844..0cd8bedc0b4 100644 --- a/src/compute/aggregate/mod.rs +++ b/src/compute/aggregate/mod.rs @@ -1,3 +1,4 @@ +//! Contains different aggregation functions mod sum; pub use sum::*; diff --git a/src/compute/aggregate/sum.rs b/src/compute/aggregate/sum.rs index d05493b8d30..dae1ad85734 100644 --- a/src/compute/aggregate/sum.rs +++ b/src/compute/aggregate/sum.rs @@ -16,6 +16,7 @@ use crate::{ /// Object that can reduce itself to a number. This is used in the context of SIMD to reduce /// a MD (e.g. `[f32; 16]`) into a single number (`f32`). pub trait Sum { + /// Reduces this element to a single value. fn simd_sum(self) -> T; } @@ -116,6 +117,7 @@ macro_rules! dyn_sum { }}; } +/// Whether [`sum`] is valid for `data_type` pub fn can_sum(data_type: &DataType) -> bool { use DataType::*; matches!( diff --git a/src/compute/boolean.rs b/src/compute/boolean.rs index 55b3ddcf9ce..2977ef03582 100644 --- a/src/compute/boolean.rs +++ b/src/compute/boolean.rs @@ -1,20 +1,4 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - +//! null-preserving operators such as [`and`], [`or`] and [`not`]. use crate::array::{Array, BooleanArray}; use crate::bitmap::{Bitmap, MutableBitmap}; use crate::datatypes::DataType; diff --git a/src/compute/boolean_kleene.rs b/src/compute/boolean_kleene.rs index a75f9f246dc..4d65f449f22 100644 --- a/src/compute/boolean_kleene.rs +++ b/src/compute/boolean_kleene.rs @@ -1,3 +1,4 @@ +//! Boolean operators of [Kleene logic](https://en.wikipedia.org/wiki/Three-valued_logic#Kleene_and_Priest_logics). use crate::datatypes::DataType; use crate::error::{ArrowError, Result}; use crate::{ diff --git a/src/compute/cast/binary_to.rs b/src/compute/cast/binary_to.rs index 689f87f1eae..f0bf65af098 100644 --- a/src/compute/cast/binary_to.rs +++ b/src/compute/cast/binary_to.rs @@ -3,6 +3,7 @@ use std::convert::TryFrom; use crate::error::{ArrowError, Result}; use crate::{array::*, buffer::Buffer, datatypes::DataType, types::NativeType}; +/// Conversion of binary pub fn binary_to_large_binary(from: &BinaryArray, to_data_type: DataType) -> BinaryArray { let values = from.values().clone(); let offsets = from.offsets().iter().map(|x| *x as i64); @@ -10,6 +11,7 @@ pub fn binary_to_large_binary(from: &BinaryArray, to_data_type: DataType) - BinaryArray::::from_data(to_data_type, offsets, values, from.validity().cloned()) } +/// Conversion of binary pub fn binary_large_to_binary( from: &BinaryArray, to_data_type: DataType, diff --git a/src/compute/cast/mod.rs b/src/compute/cast/mod.rs index 972e0eecab7..73282130424 100644 --- a/src/compute/cast/mod.rs +++ b/src/compute/cast/mod.rs @@ -1,19 +1,4 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. +//! Defines different casting operators such as [`cast`] or [`primitive_to_binary`]. use crate::{ array::*, diff --git a/src/compute/cast/primitive_to.rs b/src/compute/cast/primitive_to.rs index 8b7bf67769d..2eea683003b 100644 --- a/src/compute/cast/primitive_to.rs +++ b/src/compute/cast/primitive_to.rs @@ -181,30 +181,37 @@ const fn time_unit_multiple(unit: TimeUnit) -> i64 { } } +/// Conversion of dates pub fn date32_to_date64(from: &PrimitiveArray) -> PrimitiveArray { unary(from, |x| x as i64 * MILLISECONDS_IN_DAY, DataType::Date64) } +/// Conversion of dates pub fn date64_to_date32(from: &PrimitiveArray) -> PrimitiveArray { unary(from, |x| (x / MILLISECONDS_IN_DAY) as i32, DataType::Date32) } +/// Conversion of times pub fn time32s_to_time32ms(from: &PrimitiveArray) -> PrimitiveArray { unary(from, |x| x * 1000, DataType::Time32(TimeUnit::Millisecond)) } +/// Conversion of times pub fn time32ms_to_time32s(from: &PrimitiveArray) -> PrimitiveArray { unary(from, |x| x / 1000, DataType::Time32(TimeUnit::Second)) } +/// Conversion of times pub fn time64us_to_time64ns(from: &PrimitiveArray) -> PrimitiveArray { unary(from, |x| x * 1000, DataType::Time64(TimeUnit::Nanosecond)) } +/// Conversion of times pub fn time64ns_to_time64us(from: &PrimitiveArray) -> PrimitiveArray { unary(from, |x| x / 1000, DataType::Time64(TimeUnit::Microsecond)) } +/// Conversion of timestamp pub fn timestamp_to_date64(from: &PrimitiveArray, from_unit: TimeUnit) -> PrimitiveArray { let from_size = time_unit_multiple(from_unit); let to_size = MILLISECONDS; @@ -221,11 +228,13 @@ pub fn timestamp_to_date64(from: &PrimitiveArray, from_unit: TimeUnit) -> P } } +/// Conversion of timestamp pub fn timestamp_to_date32(from: &PrimitiveArray, from_unit: TimeUnit) -> PrimitiveArray { let from_size = time_unit_multiple(from_unit) * SECONDS_IN_DAY; unary(from, |x| (x / from_size) as i32, DataType::Date32) } +/// Conversion of time pub fn time32_to_time64( from: &PrimitiveArray, from_unit: TimeUnit, @@ -237,6 +246,7 @@ pub fn time32_to_time64( unary(from, |x| (x as i64 * divisor), DataType::Time64(to_unit)) } +/// Conversion of time pub fn time64_to_time32( from: &PrimitiveArray, from_unit: TimeUnit, @@ -252,6 +262,7 @@ pub fn time64_to_time32( ) } +/// Conversion of timestamp pub fn timestamp_to_timestamp( from: &PrimitiveArray, from_unit: TimeUnit, diff --git a/src/compute/cast/utf8_to.rs b/src/compute/cast/utf8_to.rs index 0ae03fb741e..6c042d3de48 100644 --- a/src/compute/cast/utf8_to.rs +++ b/src/compute/cast/utf8_to.rs @@ -120,6 +120,7 @@ pub fn utf8_to_timestamp_ns( utf8_to_timestamp_ns_(from, RFC3339, timezone) } +/// Conversion of utf8 pub fn utf8_to_large_utf8(from: &Utf8Array) -> Utf8Array { let data_type = Utf8Array::::default_data_type(); let values = from.values().clone(); @@ -130,6 +131,7 @@ pub fn utf8_to_large_utf8(from: &Utf8Array) -> Utf8Array { } } +/// Conversion of utf8 pub fn utf8_large_to_utf8(from: &Utf8Array) -> Result> { let data_type = Utf8Array::::default_data_type(); let values = from.values().clone(); diff --git a/src/compute/comparison/mod.rs b/src/compute/comparison/mod.rs index c688e2a1fe7..8a3071c271c 100644 --- a/src/compute/comparison/mod.rs +++ b/src/compute/comparison/mod.rs @@ -103,11 +103,17 @@ pub use utf8::compare_scalar as utf8_compare_scalar; /// Comparison operators, such as `>` ([`Operator::Gt`]) #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Operator { + /// Less than Lt, + /// Less than or equal to LtEq, + /// Greater than Gt, + /// Greater than or equal to GtEq, + /// Equal Eq, + /// Not equal Neq, } diff --git a/src/compute/comparison/simd/mod.rs b/src/compute/comparison/simd/mod.rs index 3fe82b81dbb..ec85c53f9d0 100644 --- a/src/compute/comparison/simd/mod.rs +++ b/src/compute/comparison/simd/mod.rs @@ -2,17 +2,27 @@ use crate::types::NativeType; /// [`NativeType`] that supports a representation of 8 lanes pub trait Simd8: NativeType { + /// The 8 lane representation of `Self` type Simd: Simd8Lanes; } +/// Trait declaring an 8-lane multi-data. pub trait Simd8Lanes: Copy { + /// loads a complete chunk fn from_chunk(v: &[T]) -> Self; + /// loads an incomplete chunk, filling the remaining items with `remaining`. fn from_incomplete_chunk(v: &[T], remaining: T) -> Self; + /// Equal fn eq(self, other: Self) -> u8; + /// Not equal fn neq(self, other: Self) -> u8; + /// Less than or equal to fn lt_eq(self, other: Self) -> u8; + /// Less than fn lt(self, other: Self) -> u8; + /// Greater than fn gt(self, other: Self) -> u8; + /// Greater than or equal to fn gt_eq(self, other: Self) -> u8; } diff --git a/src/compute/contains.rs b/src/compute/contains.rs index 8afec9e2a36..b1385924cb0 100644 --- a/src/compute/contains.rs +++ b/src/compute/contains.rs @@ -1,19 +1,4 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. +//! Declares the [`contains`] operator use crate::types::NativeType; use crate::{ @@ -141,6 +126,7 @@ macro_rules! primitive { }}; } +/// Returns whether each element in `values` is in each element from `list` pub fn contains(list: &dyn Array, values: &dyn Array) -> Result { let list_data_type = list.data_type(); let values_data_type = values.data_type(); diff --git a/src/compute/filter.rs b/src/compute/filter.rs index 12ac2a2ada0..b14aa337035 100644 --- a/src/compute/filter.rs +++ b/src/compute/filter.rs @@ -1,20 +1,4 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - +//! Contains operators to filter arrays such as [`filter`]. use crate::array::growable::{make_growable, Growable}; use crate::bitmap::{utils::SlicesIterator, Bitmap, MutableBitmap}; use crate::record_batch::RecordBatch; diff --git a/src/compute/hash.rs b/src/compute/hash.rs index ac06cf8ecc5..ae0a6f80862 100644 --- a/src/compute/hash.rs +++ b/src/compute/hash.rs @@ -1,3 +1,4 @@ +//! Contains the [`hash`] and typed (e.g. [`hash_primitive`]) operators. use ahash::{CallHasher, RandomState}; use multiversion::multiversion; use std::hash::Hash; @@ -18,18 +19,18 @@ use crate::{ use super::arity::unary; -/// Element-wise hash of a [`PrimitiveArray`]. Validity is preserved. #[multiversion] #[clone(target = "x86_64+aes+sse3+ssse3+avx+avx2")] +/// Element-wise hash of a [`PrimitiveArray`]. Validity is preserved. pub fn hash_primitive(array: &PrimitiveArray) -> PrimitiveArray { let state = new_state!(); unary(array, |x| T::get_hash(&x, &state), DataType::UInt64) } -/// Element-wise hash of a [`BooleanArray`]. Validity is preserved. #[multiversion] #[clone(target = "x86_64+aes+sse3+ssse3+avx+avx2")] +/// Element-wise hash of a [`BooleanArray`]. Validity is preserved. pub fn hash_boolean(array: &BooleanArray) -> PrimitiveArray { let state = new_state!(); diff --git a/src/compute/if_then_else.rs b/src/compute/if_then_else.rs index 9cfb1cc6f8e..36261e5ac1e 100644 --- a/src/compute/if_then_else.rs +++ b/src/compute/if_then_else.rs @@ -1,3 +1,4 @@ +//! Contains the operator [`if_then_else`]. use crate::array::growable; use crate::error::{ArrowError, Result}; use crate::{array::*, bitmap::utils::SlicesIterator}; diff --git a/src/compute/like.rs b/src/compute/like.rs index 1e0dc1e778f..d36643f5afa 100644 --- a/src/compute/like.rs +++ b/src/compute/like.rs @@ -1,3 +1,4 @@ +//! Contains "like" operators such as [`like_utf8`] and [`like_utf8_scalar`]. use std::collections::HashMap; use regex::bytes::Regex as BytesRegex; @@ -83,6 +84,12 @@ pub fn like_utf8(lhs: &Utf8Array, rhs: &Utf8Array) -> Result(lhs: &Utf8Array, rhs: &Utf8Array) -> Result { a_like_utf8(lhs, rhs, |x| !x) } @@ -146,6 +153,12 @@ pub fn like_utf8_scalar(lhs: &Utf8Array, rhs: &str) -> Result(lhs: &Utf8Array, rhs: &str) -> Result { a_like_utf8_scalar(lhs, rhs, |x| !x) } @@ -221,6 +234,13 @@ pub fn like_binary(lhs: &BinaryArray, rhs: &BinaryArray) -> Res a_like_binary(lhs, rhs, |x| x) } +/// Returns `lhs NOT LIKE rhs` operation on two [`BinaryArray`]s. +/// +/// There are two wildcards supported: +/// +/// * `%` - The percent sign represents zero, one, or multiple characters +/// * `_` - The underscore represents a single character +/// pub fn nlike_binary(lhs: &BinaryArray, rhs: &BinaryArray) -> Result { a_like_binary(lhs, rhs, |x| !x) } @@ -290,6 +310,13 @@ pub fn like_binary_scalar(lhs: &BinaryArray, rhs: &[u8]) -> Result a_like_binary_scalar(lhs, rhs, |x| x) } +/// Returns `lhs NOT LIKE rhs` operation on two [`BinaryArray`]s. +/// +/// There are two wildcards supported: +/// +/// * `%` - The percent sign represents zero, one, or multiple characters +/// * `_` - The underscore represents a single character +/// pub fn nlike_binary_scalar(lhs: &BinaryArray, rhs: &[u8]) -> Result { a_like_binary_scalar(lhs, rhs, |x| !x) } diff --git a/src/compute/limit.rs b/src/compute/limit.rs index d1056bd1e2b..d9f88c221c7 100644 --- a/src/compute/limit.rs +++ b/src/compute/limit.rs @@ -1,23 +1,8 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. +//! Contains the operator [`limit`]. use crate::array::Array; -/// Returns the array, taking only the number of elements specified +/// Returns the [`Array`] limited by `num_elements`. /// /// Limit performs a zero-copy slice of the array, and is a convenience method on slice /// where: diff --git a/src/compute/merge_sort/mod.rs b/src/compute/merge_sort/mod.rs index b1a4e838fe8..c619229a005 100644 --- a/src/compute/merge_sort/mod.rs +++ b/src/compute/merge_sort/mod.rs @@ -233,8 +233,8 @@ fn recursive_merge_sort(slices: &[&[MergeSlice]], comparator: &Comparator) -> Ve merge_sort_slices(lhs.iter(), rhs.iter(), comparator).collect::>() } -// An iterator adapter that merge-sorts two iterators of `MergeSlice` into a single `MergeSlice` -// such that the resulting `MergeSlice`s are ordered according to `comparator`. +/// An iterator adapter that merge-sorts two iterators of `MergeSlice` into a single `MergeSlice` +/// such that the resulting `MergeSlice`s are ordered according to `comparator`. pub struct MergeSortSlices<'a, L, R> where L: Iterator, diff --git a/src/compute/nullif.rs b/src/compute/nullif.rs index ec0ebfad896..709ab84a029 100644 --- a/src/compute/nullif.rs +++ b/src/compute/nullif.rs @@ -1,3 +1,4 @@ +//! Contains the operator [`nullif`]. use crate::array::PrimitiveArray; use crate::bitmap::Bitmap; use crate::compute::comparison::{primitive_compare_values_op, Simd8, Simd8Lanes}; diff --git a/src/compute/regex_match.rs b/src/compute/regex_match.rs index c1972ea0906..0a36c031de9 100644 --- a/src/compute/regex_match.rs +++ b/src/compute/regex_match.rs @@ -1,19 +1,4 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. +//! Contains regex matching operators [`regex_match`] and [`regex_match_scalar`]. use std::collections::HashMap; @@ -25,6 +10,7 @@ use crate::datatypes::DataType; use crate::error::{ArrowError, Result}; use crate::{array::*, bitmap::Bitmap}; +/// Regex matches pub fn regex_match(values: &Utf8Array, regex: &Utf8Array) -> Result { if values.len() != regex.len() { return Err(ArrowError::InvalidArgumentError( diff --git a/src/compute/sort/lex_sort.rs b/src/compute/sort/lex_sort.rs index 7fe0c2bc864..1b0182e1202 100644 --- a/src/compute/sort/lex_sort.rs +++ b/src/compute/sort/lex_sort.rs @@ -15,7 +15,9 @@ type IsValid<'a> = Box bool + 'a>; /// One column to be used in lexicographical sort #[derive(Clone, Debug)] pub struct SortColumn<'a> { + /// The array to sort pub values: &'a dyn Array, + /// The options to apply to the sort pub options: Option, } diff --git a/src/compute/sort/mod.rs b/src/compute/sort/mod.rs index d7c0a08046d..62113946fa2 100644 --- a/src/compute/sort/mod.rs +++ b/src/compute/sort/mod.rs @@ -1,3 +1,4 @@ +//! Contains operators to sort individual and slices of [`Array`]s. use std::cmp::Ordering; use crate::array::ord; diff --git a/src/compute/take/mod.rs b/src/compute/take/mod.rs index 46075ef7aa0..4f5cb273c83 100644 --- a/src/compute/take/mod.rs +++ b/src/compute/take/mod.rs @@ -33,6 +33,8 @@ mod primitive; mod structure; mod utf8; +/// Returns a new [`Array`] with only indices at `indices`. Null indices are taken as nulls. +/// The returned array has a length equal to `indices.len()`. pub fn take(values: &dyn Array, indices: &PrimitiveArray) -> Result> { if indices.len() == 0 { return Ok(new_empty_array(values.data_type().clone())); diff --git a/src/temporal_conversions.rs b/src/temporal_conversions.rs index 32a79a81852..d66f068f357 100644 --- a/src/temporal_conversions.rs +++ b/src/temporal_conversions.rs @@ -260,6 +260,7 @@ fn utf8_to_timestamp_ns_impl( .to(DataType::Timestamp(TimeUnit::Nanosecond, Some(timezone))) } +/// Parses `value` to a [`chrono_tz::Tz`] with the Arrow's definition of timestamp with a timezone. #[cfg(feature = "chrono-tz")] #[cfg_attr(docsrs, doc(cfg(feature = "chrono-tz")))] pub fn parse_offset_tz(timezone: &str) -> Result { diff --git a/src/types/mod.rs b/src/types/mod.rs index 0bf096fe9f5..d74c9d1c078 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -359,21 +359,25 @@ create_relation!( ); impl months_days_ns { + /// A new [`months_days_ns`]. #[inline] pub fn new(months: i32, days: i32, nanoseconds: i64) -> Self { Self(months, days, nanoseconds) } + /// The number of months #[inline] pub fn months(&self) -> i32 { self.0 } + /// The number of days #[inline] pub fn days(&self) -> i32 { self.1 } + /// The number of nanoseconds #[inline] pub fn ns(&self) -> i64 { self.2 diff --git a/src/types/simd/mod.rs b/src/types/simd/mod.rs index eabbe00f640..c0e90e4e710 100644 --- a/src/types/simd/mod.rs +++ b/src/types/simd/mod.rs @@ -36,6 +36,8 @@ pub unsafe trait NativeSimd: Default + Copy { /// remaining items are populated with `remaining`. fn from_incomplete_chunk(v: &[Self::Native], remaining: Self::Native) -> Self; + /// Returns a tuple of 3 items whose middle item is itself, and the remaining + /// are the head and tail of the un-aligned parts. fn align(values: &[Self::Native]) -> (&[Self::Native], &[Self], &[Self::Native]); } diff --git a/src/types/simd/native.rs b/src/types/simd/native.rs index 1ab1f748c92..25568525595 100644 --- a/src/types/simd/native.rs +++ b/src/types/simd/native.rs @@ -5,6 +5,7 @@ use super::*; macro_rules! simd { ($name:tt, $type:ty, $lanes:expr, $mask:ty) => { + /// Multi-Data correspondence of the native type #[allow(non_camel_case_types)] #[derive(Copy, Clone)] pub struct $name(pub [$type; $lanes]);