mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
29 lines
590 B
Rust
29 lines
590 B
Rust
pub mod errors;
|
|
pub mod mandates;
|
|
pub mod payments;
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
pub enum RemoteStorageObject<T: ForeignIDRef> {
|
|
ForeignID(String),
|
|
Object(T),
|
|
}
|
|
|
|
impl<T: ForeignIDRef> From<T> for RemoteStorageObject<T> {
|
|
fn from(value: T) -> Self {
|
|
Self::Object(value)
|
|
}
|
|
}
|
|
|
|
pub trait ForeignIDRef {
|
|
fn foreign_id(&self) -> String;
|
|
}
|
|
|
|
impl<T: ForeignIDRef> RemoteStorageObject<T> {
|
|
pub fn get_id(&self) -> String {
|
|
match self {
|
|
Self::ForeignID(id) => id.clone(),
|
|
Self::Object(i) => i.foreign_id(),
|
|
}
|
|
}
|
|
}
|