Je veux paginer les UnorderedSet Peut-on le faire, quelles sont les collections que je dois utiliser pour cela ?
Voici mon code :
user_products_map: TreeMap<u128, UnorderedSet<u128>>
pub fn get_products_of_user_id(&self, user_id: u128) -> Vec<u128> {
let products_set_option = self.user_products_map.get(&user_id);
match products_set_option {
Some(products_set) => products_set.to_vec(),
None => {
panic!("No products for user");
}
}
}
Je veux paginer comme :
pub fn get_products_of_user_id(&self, start:u128, end:u128, user_id: u128) -> Vec<u128> {
let products_set_option = self.user_products_map.get(&user_id);
match products_set_option {
Some(products_set) => products_set[start, end].to_vec(),
None => {
panic!("No products for user");
}
}
}