pub struct Request {
pub url: String,
pub method: String,
pub headers: HashMap<String, String>,
pub allow_revisit: bool,
pub context: HashMap<String, String>,
pub body: Vec<u8>,
pub aborted: bool,
}Expand description
爬虫请求封装
每次访问都会构造一个 Request,经过回调链后交给 HttpClient 执行。
Fields§
§url: String目标 URL
method: StringHTTP 方法
headers: HashMap<String, String>自定义请求头
allow_revisit: bool是否允许重复访问(跳过 visited 去重检查)
context: HashMap<String, String>用户自定义上下文,可在回调间传递数据
body: Vec<u8>POST 请求体
aborted: bool是否已被回调中止(调用 abort() 后为 true)
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more