http_range_client/
range_client.rs

1use crate::error::Result;
2use async_trait::async_trait;
3use bytes::Bytes;
4use std::str;
5
6#[cfg(not(target_arch = "wasm32"))]
7#[async_trait]
8/// Async HTTP client for Range requests
9pub trait AsyncHttpRangeClient {
10    /// Send a GET range request
11    async fn get_range(&self, url: &str, range: &str) -> Result<Bytes>;
12    /// Send a HEAD request and return response header value
13    async fn head_response_header(&self, url: &str, header: &str) -> Result<Option<String>>;
14}
15
16#[cfg(target_arch = "wasm32")]
17#[async_trait(?Send)]
18/// Async HTTP client for Range requests
19pub trait AsyncHttpRangeClient {
20    /// Send a GET range request
21    async fn get_range(&self, url: &str, range: &str) -> Result<Bytes>;
22    /// Send a HEAD request and return response header value
23    async fn head_response_header(&self, url: &str, header: &str) -> Result<Option<String>>;
24}
25
26/// Sync HTTP client for Range requests
27pub trait SyncHttpRangeClient {
28    /// Send a GET range request
29    fn get_range(&self, url: &str, range: &str) -> Result<Bytes>;
30    /// Send a HEAD request and return response header value
31    fn head_response_header(&self, url: &str, header: &str) -> Result<Option<String>>;
32}