pub enum Collector {
File(FileInfo),
Ram(Vec<u8>),
RamAndHeaders(Vec<u8>, Vec<u8>),
FileAndHeaders(FileInfo, Vec<u8>),
Streaming(StreamHandler, Vec<u8>),
}
Expand description
Collector::File(FileInfo) is used to be able to download and upload files.
Collector::Ram(Vec<u8>
) is used to store response body into Memory.
Collector::RamWithHeaders(Vec<u8>
, Vec<u8>
) is used to store response body into Memory and with complete headers.
Collector::FileAndHeaders(FileInfo
, Vec<u8>
) is used to be able to download and upload files and with complete headers.
Collector::Streaming(StreamHandler
, Vec<u8>
) is used to process the response body as a stream of chunks instead of buffering the entire
response in memory or writing it directly to a file.
Variants§
File(FileInfo)
Collector::File(FileInfo
) is used to be able to download and upload files.
Ram(Vec<u8>)
Collector::Ram(Vec<u8>
) is used to store response body into Memory.
RamAndHeaders(Vec<u8>, Vec<u8>)
Collector::RamWithHeaders(Vec<u8>
, Vec<u8>
) is used to store response body into Memory and with complete headers.
FileAndHeaders(FileInfo, Vec<u8>)
Collector::FileAndHeaders(FileInfo
, Vec<u8>
) is used to be able to download and upload files and with complete headers.
Streaming(StreamHandler, Vec<u8>)
Collector::Streaming(StreamHandler
, Vec<u8>
) is used to process
the response body as a stream of chunks instead of buffering the entire
response in memory or writing it directly to a file with complete headers.
This is useful for large responses, continuous data feeds, or situations
where you don’t want to block until the full body is received.
Trait Implementations§
Source§impl ExtendedHandler for Collector
impl ExtendedHandler for Collector
Source§fn get_response_body(&self) -> Option<Vec<u8>>
fn get_response_body(&self) -> Option<Vec<u8>>
If Collector::File(FileInfo) is set, there will be no response body since the response will be stored into a file.
If Collector::Ram(Vec<u8>
) is set, the response body can be obtain here.
Source§fn get_response_body_and_headers(&self) -> (Option<Vec<u8>>, Option<HeaderMap>)
fn get_response_body_and_headers(&self) -> (Option<Vec<u8>>, Option<HeaderMap>)
If Collector::File(FileInfo
) is set, there will be no response body since the response will be stored into a file.
If Collector::Ram(Vec<u8>
) is set, the response body can be obtain here.
If Collector::RamAndHeaders(Vec<u8>
, Vec<u8>
) is set, the response body and the complete headers are generated.
If Collector::FileAndHeaders(FileInfo
, Vec<u8>
) is set, there will be no response body since the response will be stored into a file but a complete headers are generated.
Source§impl Handler for Collector
impl Handler for Collector
Source§fn write(&mut self, data: &[u8]) -> Result<usize, WriteError>
fn write(&mut self, data: &[u8]) -> Result<usize, WriteError>
This will store the response from the server to the data vector or into a file depends on the Collector being used.
Source§fn read(&mut self, data: &mut [u8]) -> Result<usize, ReadError>
fn read(&mut self, data: &mut [u8]) -> Result<usize, ReadError>
This will read the chunks of data from a file that will be uploaded to the server. This will be use if the Collector is Collector::File(FileInfo).