pub fn batched(self) -> Vec<ScalarFilter> {
        fn inner(mut list: PrismaListValue) -> Vec<PrismaListValue> {
            let dedup_list: BTreeSet<_> = list.drain(..).collect();

            let mut batches = Vec::with_capacity(list.len() % *MAX_BATCH_SIZE + 1);
            batches.push(Vec::with_capacity(*MAX_BATCH_SIZE));

            for (idx, item) in dedup_list.into_iter().enumerate() {
                if idx != 0 && idx % *MAX_BATCH_SIZE == 0 {
                    batches.push(Vec::with_capacity(*MAX_BATCH_SIZE));
                }

                batches.last_mut().unwrap().push(item);
            }

            batches
        }

        let mode = self.mode.clone();

        match self.condition {
            ScalarCondition::In(list) => {
                let projection = self.projection;

                inner(list)
                    .into_iter()
                    .map(|batch| ScalarFilter {
                        projection: projection.clone(),
                        condition: ScalarCondition::In(batch),
                        mode: mode.clone(),
                    })
                    .collect()
            }

            ScalarCondition::NotIn(list) => {
                let projection = self.projection;

                inner(list)
                    .into_iter()
                    .map(|batch| ScalarFilter {
                        projection: projection.clone(),
                        condition: ScalarCondition::NotIn(batch),
                        mode: mode.clone(),
                    })
                    .collect()
            }
            _ => vec![self],
        }
    }
/// If possible, converts the filter into multiple smaller filters.
If possible, converts the filter into multiple smaller filters.
If possible converts the filter into multiple smaller filters .
pub fn batched(self) -> Vec<ScalarFilter> {
        fn inner(mut list: PrismaListValue) -> Vec<PrismaListValue> {
            let dedup_list: BTreeSet<_> = list.drain(..).collect();
            let mut batches = Vec::with_capacity(list.len() % *MAX_BATCH_SIZE + 1);
            batches.push(Vec::with_capacity(*MAX_BATCH_SIZE));
            for (idx, item) in dedup_list.into_iter().enumerate() {
                if idx != 0 && idx % *MAX_BATCH_SIZE == 0 {
                    batches.push(Vec::with_capacity(*MAX_BATCH_SIZE));
                }
                batches.last_mut().unwrap().push(item);
            }
            batches
        }
        let mode = self.mode.clone();
        match self.condition {
            ScalarCondition::In(list) => {
                let projection = self.projection;
                inner(list)
                    .into_iter()
                    .map(|batch| ScalarFilter {
                        projection: projection.clone(),
                        condition: ScalarCondition::In(batch),
                        mode: mode.clone(),
                    })
                    .collect()
            }
            ScalarCondition::NotIn(list) => {
                let projection = self.projection;
                inner(list)
                    .into_iter()
                    .map(|batch| ScalarFilter {
                        projection: projection.clone(),
                        condition: ScalarCondition::NotIn(batch),
                        mode: mode.clone(),
                    })
                    .collect()
            }
            _ => vec![self],
        }
    }
pub fn batched ( self ) -> Vec < ScalarFilter > { fn inner ( mut list : PrismaListValue ) -> Vec < PrismaListValue > { let dedup_list : BTreeSet < _ > = list . drain ( .. ) . collect ( ) ; let mut batches = Vec :: with_capacity ( list . len ( ) % * MAX_BATCH_SIZE + 1 ) ; batches . push ( Vec :: with_capacity ( * MAX_BATCH_SIZE ) ) ; for ( idx , item ) in dedup_list . into_iter ( ) . enumerate ( ) { if idx != 0 && idx % * MAX_BATCH_SIZE == 0 { batches . push ( Vec :: with_capacity ( * MAX_BATCH_SIZE ) ) ; } batches . last_mut ( ) . unwrap ( ) . push ( item ) ; } batches } let mode = self . mode . clone ( ) ; match self . condition { ScalarCondition :: In ( list ) => { let projection = self . projection ; inner ( list ) . into_iter ( ) . map ( | batch | ScalarFilter { projection : projection . clone ( ) , condition : ScalarCondition :: In ( batch ) , mode : mode . clone ( ) , } ) . collect ( ) } ScalarCondition :: NotIn ( list ) => { let projection = self . projection ; inner ( list ) . into_iter ( ) . map ( | batch | ScalarFilter { projection : projection . clone ( ) , condition : ScalarCondition :: NotIn ( batch ) , mode : mode . clone ( ) , } ) . collect ( ) } _ => vec ! [ self ] , } }
If possible, converts the filter into multiple smaller filters.
If possible converts the filter into multiple smaller filters .
self
self