Skip to main content

pir_client/
transport.rs

1use std::{future::Future, pin::Pin};
2
3use anyhow::Result;
4
5pub type TransportFuture<'a> = Pin<Box<dyn Future<Output = Result<TransportResponse>> + Send + 'a>>;
6
7pub trait Transport: Send + Sync {
8    fn get<'a>(&'a self, url: &'a str) -> TransportFuture<'a>;
9
10    fn post<'a>(&'a self, url: &'a str, body: Vec<u8>) -> TransportFuture<'a>;
11}
12
13#[derive(Clone)]
14pub struct TransportResponse {
15    pub status: u16,
16    pub headers: Vec<(String, String)>,
17    pub body: Vec<u8>,
18}