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


##########
arrow-buffer/src/native.rs:
##########
@@ -46,229 +46,128 @@ mod private {
 pub trait ArrowNativeType:
     std::fmt::Debug + Send + Sync + Copy + PartialOrd + Default + 
private::Sealed + 'static
 {
-    /// Convert native type from usize.
-    #[inline]
-    fn from_usize(_: usize) -> Option<Self> {
-        None
-    }
+    /// Convert native integer type from usize
+    ///
+    /// Returns `None` if [`Self`] is not an integer or conversion would result
+    /// in truncation/overflow
+    fn from_usize(_: usize) -> Option<Self>;
+
+    /// Convert to usize according to the [`as`] operator
+    ///
+    /// [`as`]: 
https://doc.rust-lang.org/reference/expressions/operator-expr.html#numeric-cast
+    fn as_usize(self) -> usize;

Review Comment:
   I wasn't entirely sure about this, but taking a Copy type by reference seems 
strange, so I changed to take it by value



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to