pub struct ScreepsHttpClient {
pub client: Client,
pub config: ScreepsConfig,
pub rate_limits: Mutex<RateLimits>,
pub token: Mutex<Option<String>>,
}Expand description
Screeps http 客户端
Fields§
§client: Client请求客户端
config: ScreepsConfig配置
rate_limits: Mutex<RateLimits>限速信息
token: Mutex<Option<String>>最新的 token
Implementations§
Source§impl ScreepsHttpClient
impl ScreepsHttpClient
pub fn new(config: ScreepsConfig) -> Self
Sourcepub async fn request<T: Serialize, U: DeserializeOwned>(
&self,
method: Method,
path: &str,
body: Option<T>,
) -> ScreepsResult<U>
pub async fn request<T: Serialize, U: DeserializeOwned>( &self, method: Method, path: &str, body: Option<T>, ) -> ScreepsResult<U>
封装 get 请求和 post 请求
Source§impl ScreepsHttpClient
impl ScreepsHttpClient
Sourcepub async fn auth(&self) -> ScreepsResult<TokenData>
pub async fn auth(&self) -> ScreepsResult<TokenData>
登录以获取 token
Auto Trait Implementations§
impl !Freeze for ScreepsHttpClient
impl !RefUnwindSafe for ScreepsHttpClient
impl Send for ScreepsHttpClient
impl Sync for ScreepsHttpClient
impl Unpin for ScreepsHttpClient
impl !UnwindSafe for ScreepsHttpClient
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