pub fn longhaul_req<T: DeserializeOwned>(
        &self,
        endpoint: &str,
        method: &str,
    ) -> Result<LongHaul<T>> {
        let resp = self
            .build_request_without_timeout(endpoint, method)?
            .call()?;

        if resp.status() >= 400 {
            return Err(Error::FailedResponse(resp.status()));
        }

        Ok(LongHaul::new(Box::new(resp.into_reader())))
    }
/// Send a longhaul request to the specific endpoint with method,
/// Underlying is an http stream with chunked-encoding.
///
/// Use [`LongHaul::next_item`], [`LongHaul::next_raw`] or [`Iterator::next`] to retreive data
///
/// # Examplel
///
/// ```rust
/// # use clashctl_core::{ Clash, model::Traffic }; use std::env;
/// # fn main() {
/// # let clash = Clash::builder(env::var("PROXY_ADDR").unwrap()).unwrap().build();
/// let traffics = clash.longhaul_req::<Traffic>("traffic", "GET").expect("connect failed");
///
/// // LongHaul implements `Iterator` so you can use iterator combinators
/// for traffic in traffics.take(3) {
///     println!("{:#?}", traffic)
/// }
/// # }
/// ```
Send a longhaul request to the specific endpoint with method,
Underlying is an http stream with chunked-encoding.


Send a longhaul request to the specific endpoint with method Underlying is an http stream with chunked - encoding .
pub fn longhaul_req<T: DeserializeOwned>(
        &self,
        endpoint: &str,
        method: &str,
    ) -> Result<LongHaul<T>> {
        let resp = self
            .build_request_without_timeout(endpoint, method)?
            .call()?;
        if resp.status() >= 400 {
            return Err(Error::FailedResponse(resp.status()));
        }
        Ok(LongHaul::new(Box::new(resp.into_reader())))
    }
pub fn longhaul_req < T : DeserializeOwned > ( & self , endpoint : & str , method : & str , ) -> Result < LongHaul < T > > { let resp = self . build_request_without_timeout ( endpoint , method ) ? . call ( ) ? ; if resp . status ( ) >= 400 { return Err ( Error :: FailedResponse ( resp . status ( ) ) ) ; } Ok ( LongHaul :: new ( Box :: new ( resp . into_reader ( ) ) ) ) }
Send a longhaul request to the specific endpoint with method,
Underlying is an http stream with chunked-encoding.
Send a longhaul request to the specific endpoint with method Underlying is an http stream with chunked - encoding .
&self
endpoint
&str
method
&str
&self
endpoint
&str
method
&str
examplel
None
use clashctl_core::{ clash, model::traffic }; use std::env;
None
fn main() {
None
let clash = clash::builder(env::var("proxy_addr").unwrap()).unwrap().build();
let traffics = clash.longhaul_req::("traffic", "GET").expect("connect failed").

LongHaul implements `Iterator` so you can use iterator combinators
for traffic in traffics.take(3) {
println!("{:#?}", traffic)
}
let traffics = clash . longhaul_req :: ( " traffic " " GET " ) . expect ( " connect failed " ) . LongHaul implements ` Iterator ` so you can use iterator combinators for traffic in traffics . take ( 3 ) { println! ( " { : #? } " traffic ) }
}
None