tinfoil-knight commented on PR #10117:
URL: 
https://github.com/apache/arrow-datafusion/pull/10117#issuecomment-2062012465

   @ozankabak Are you suggesting something like this?
   
   ```rust
   use std::ops::Deref;
   
   struct LimitedVector(Vec<Option<bool>>);
   
   impl LimitedVector {
       fn new(initial: Vec<Option<bool>>) -> Result<Self, &'static str> {
           if initial.len() >= 2 {
               Ok(LimitedVector(initial))
           } else {
               Err("Initial vector length must be 2 or more")
           }
       }
   }
   
   impl Deref for LimitedVector {
       type Target = Vec<Option<bool>>;
   
       fn deref(&self) -> &Self::Target {
           &self.0
       }
   }
   
   // Example usage:
   fn main() {
       let initial_vector = vec![Some(true), None];
       match LimitedVector::new(initial_vector) {
           Ok(limited_vector) => {
               println!("Length: {}", limited_vector.len()); // Length: 2
               println!("Elements: {:?}", *limited_vector); // Elements: 
[Some(true), None]
           }
           Err(err) => println!("Error: {}", err),
       }
   }
   ```


-- 
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