pub enum CFResult {
CFCommentVec(Vec<CFComment>),
CFBlogEntry(CFBlogEntry),
CFHackVec(Vec<CFHack>),
CFContestVec(Vec<CFContest>),
CFRatingChangeVec(Vec<CFRatingChange>),
CFContestStandings(CFContestStandings),
CFSubmissionVec(Vec<CFSubmission>),
CFProblemset(CFProblemset),
CFRecentActionVec(Vec<CFRecentAction>),
CFBlogEntryVec(Vec<CFBlogEntry>),
CFFriends(Vec<String>),
CFUserVec(Vec<CFUser>),
}
Expand description
Wrapper for all forms of result returned by the Codeforces API.
§Examples
You probably want to match on it depending on the kind of request you are making.
let x = CFContestCommand::Status {
contest_id: 1485,
handle: None,
from: Some(1),
count: Some(3),
};
// x.get(..) will return a CFResult type. You should match on it to make
// sure that it returned the type you expected.
// To check which type a request should return, you can check its docs.
// If the type returned is of the form `Ok(<unexpected_type>)`, then an
// internal parsing issue has occurred somewhere (this should be rare).
if let Ok(CFResult::CFSubmissionVec(v)) = x.get(api_key, api_secret) {
// your code here
}
Variants§
CFCommentVec(Vec<CFComment>)
CFBlogEntry(CFBlogEntry)
CFHackVec(Vec<CFHack>)
CFContestVec(Vec<CFContest>)
CFRatingChangeVec(Vec<CFRatingChange>)
CFContestStandings(CFContestStandings)
CFSubmissionVec(Vec<CFSubmission>)
CFProblemset(CFProblemset)
CFRecentActionVec(Vec<CFRecentAction>)
CFBlogEntryVec(Vec<CFBlogEntry>)
CFFriends(Vec<String>)
CFUserVec(Vec<CFUser>)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CFResult
impl<'de> Deserialize<'de> for CFResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for CFResult
Auto Trait Implementations§
impl Freeze for CFResult
impl RefUnwindSafe for CFResult
impl Send for CFResult
impl Sync for CFResult
impl Unpin for CFResult
impl UnwindSafe for CFResult
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