Collector

Enum Collector 

Source
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 Clone for Collector

Source§

fn clone(&self) -> Collector

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Collector

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ExtendedHandler for Collector

Source§

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>)

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

Source§

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>

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).

Source§

fn header(&mut self, data: &[u8]) -> bool

Callback that receives header data Read more
Source§

fn progress( &mut self, dltotal: f64, dlnow: f64, ultotal: f64, ulnow: f64, ) -> bool

Callback to progress meter function Read more
Source§

fn seek(&mut self, whence: SeekFrom) -> SeekResult

User callback for seeking in input stream. Read more
Source§

fn debug(&mut self, kind: InfoType, data: &[u8])

Specify a debug callback Read more
Source§

fn ssl_ctx(&mut self, cx: *mut c_void) -> Result<(), Error>

Callback to SSL context Read more
Source§

fn open_socket( &mut self, family: i32, socktype: i32, protocol: i32, ) -> Option<i32>

Callback to open sockets for libcurl. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,