pub struct Endpoint {
pub method: Method,
pub path: String,
}Expand description
Rate limited endpoint.
The rate limiter dynamically supports new or unknown API paths, but is consequently unable to catch invalid arguments. Invalidly structured endpoints may be permitted at an improper time.
§Example
use twilight_http_ratelimiting::{Endpoint, Method};
let url = "https://discord.com/api/v10/guilds/745809834183753828/audit-logs?limit=10";
let endpoint = Endpoint {
method: Method::Get,
path: String::from("guilds/745809834183753828/audit-logs"),
};
let permit = rate_limiter.acquire(endpoint).await;
let headers = unimplemented!("GET {url}");
permit.complete(headers);Fields§
§method: MethodMethod of the endpoint.
path: StringAPI path of the endpoint.
Should not start with a slash (/) or include query parameters (?key=value).
Trait Implementations§
impl Eq for Endpoint
impl StructuralPartialEq for Endpoint
Auto Trait Implementations§
impl Freeze for Endpoint
impl RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnwindSafe for Endpoint
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.