feat: add routing support for v2 sdk session flow (#6763)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Hrithikesh
2025-03-26 13:47:52 +05:30
committed by GitHub
parent d58685071b
commit c3e8c67bfa
65 changed files with 3470 additions and 3993 deletions

View File

@ -381,20 +381,41 @@ macro_rules! create_list_wrapper {
$($function_def: tt)*
}
) => {
#[derive(Clone, Debug)]
pub struct $wrapper_name(Vec<$type_name>);
impl $wrapper_name {
pub fn new(list: Vec<$type_name>) -> Self {
Self(list)
}
pub fn iter(&self) -> std::slice::Iter<'_, $type_name> {
self.0.iter()
pub fn with_capacity(size: usize) -> Self {
Self(Vec::with_capacity(size))
}
$($function_def)*
}
impl Iterator for $wrapper_name {
impl std::ops::Deref for $wrapper_name {
type Target = Vec<$type_name>;
fn deref(&self) -> &<Self as std::ops::Deref>::Target {
&self.0
}
}
impl std::ops::DerefMut for $wrapper_name {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl IntoIterator for $wrapper_name {
type Item = $type_name;
fn next(&mut self) -> Option<Self::Item> {
self.0.pop()
type IntoIter = std::vec::IntoIter<$type_name>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl<'a> IntoIterator for &'a $wrapper_name {
type Item = &'a $type_name;
type IntoIter = std::slice::Iter<'a, $type_name>;
fn into_iter(self) -> Self::IntoIter {
self.0.iter()
}
}