Struct leetcode_api::leetcode::LeetCode
source · pub struct LeetCode {
pub client: Client,
pub headers: HeaderMap,
}
Expand description
interact with leetcode.com/cn
Fields§
§client: Client
§headers: HeaderMap
Implementations§
source§impl LeetCode
impl LeetCode
sourcepub async fn sync_problem_index(&self) -> Result<()>
pub async fn sync_problem_index(&self) -> Result<()>
get leetcode index
§Errors
- network error
- leetcode url change
DbErr
force
: when true will force update
sourcepub async fn sync_index_topic(&self) -> Result<()>
pub async fn sync_index_topic(&self) -> Result<()>
get question titleSlug and topicTags info
source§impl LeetCode
impl LeetCode
sourcepub async fn submit_code(
&self,
idslug: IdSlug,
) -> Result<(SubmitInfo, RunResult)>
pub async fn submit_code( &self, idslug: IdSlug, ) -> Result<(SubmitInfo, RunResult)>
submit code by id or slug, once submit one question
idslug
: id or slug
sourcepub async fn get_submit_res(&self, sub_id: &SubmitInfo) -> Result<RunResult>
pub async fn get_submit_res(&self, sub_id: &SubmitInfo) -> Result<RunResult>
Get one submit info
sub_id
: be fetchsubmission_id
sourcepub async fn all_submit_res(&self, idslug: IdSlug) -> Result<SubmissionList>
pub async fn all_submit_res(&self, idslug: IdSlug) -> Result<SubmissionList>
Get all submission results for a question
pub async fn test_code(&self, idslug: IdSlug) -> Result<(TestInfo, RunResult)>
source§impl LeetCode
impl LeetCode
sourcepub async fn dow_user_avator(&self, status: &UserStatus) -> PathBuf
pub async fn dow_user_avator(&self, status: &UserStatus) -> PathBuf
download user avatar image
pub async fn pass_qs_status(&self, user_slug: &str) -> Result<PassData>
pub async fn get_points(&self) -> Result<TotalPoints>
pub async fn get_user_info(&self) -> Result<UserStatus>
sourcepub async fn daily_checkin(&self) -> (CheckInData, CheckInData)
pub async fn daily_checkin(&self) -> (CheckInData, CheckInData)
§Ensure that the cookies are obtained
§Example
ⓘ
let status = glob_leetcode()
.await
.get_user_info()?
.unwrap();
// if user_slug is None, the cookies were not obtained
if !status.checked_in_today && status.user_slug.is_some() {
let res = glob_leetcode()
.await
.daily_checkin()
.await;
}
return order (cn, com)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LeetCode
impl !RefUnwindSafe for LeetCode
impl Send for LeetCode
impl Sync for LeetCode
impl Unpin for LeetCode
impl !UnwindSafe for LeetCode
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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
source§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.