tustvold commented on code in PR #3965:
URL: https://github.com/apache/arrow-rs/pull/3965#discussion_r1149765736


##########
arrow-schema/src/fields.rs:
##########
@@ -0,0 +1,139 @@
+// 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.
+
+use crate::{Field, FieldRef};
+use std::ops::Deref;
+use std::sync::Arc;
+
+/// A cheaply cloneable, owned slice of [`FieldRef`]
+///
+/// Similar to `Arc<Vec<FieldPtr>>` or `Arc<[FieldPtr]>`
+///
+/// Can be constructed in a number of ways
+///
+/// ```
+/// # use std::sync::Arc;
+/// # use arrow_schema::{DataType, Field, Fields};
+/// // Can be constructed from Vec<Field>
+/// Fields::from(vec![Field::new("a", DataType::Boolean, false)]);
+/// // Can be constructed from Vec<FieldRef>
+/// Fields::from(vec![Arc::new(Field::new("a", DataType::Boolean, false))]);
+/// // Can be constructed from an iterator of Field
+/// std::iter::once(Field::new("a", DataType::Boolean, 
false)).collect::<Fields>();
+/// // Can be constructed from an iterator of FieldRef
+/// std::iter::once(Arc::new(Field::new("a", DataType::Boolean, 
false))).collect::<Fields>();
+/// ```
+///
+#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub struct Fields(Arc<[FieldRef]>);

Review Comment:
   I originally defined `Fields = Vec<FieldPtr>`
   
   Whilst simple the lack of a newtype made for a more convoluted migration, 
with a newtype we can define conversions `From<Vec<Field>>`, etc... to help 
reduce friction



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to