-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rsjudge-judger): ✨ try to implement judge request module
- Loading branch information
1 parent
84f04f1
commit ca3cc08
Showing
8 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod request; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use bytes::Bytes; | ||
|
||
use crate::judger::request::{source::Source, test_cases::TestCases}; | ||
|
||
mod source; | ||
|
||
mod test_cases; | ||
|
||
pub struct JudgeRequest { | ||
source: Source, | ||
judge_type: JudgeType, | ||
} | ||
|
||
impl JudgeRequest { | ||
pub fn new(source: Source, judge_type: JudgeType) -> Self { | ||
Self { source, judge_type } | ||
} | ||
|
||
pub fn source(&self) -> &Source { | ||
&self.source | ||
} | ||
|
||
pub fn judge_type(&self) -> &JudgeType { | ||
&self.judge_type | ||
} | ||
} | ||
|
||
pub enum JudgeType { | ||
SelfTest { input: Bytes }, | ||
Submit { cases: TestCases }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use bytes::Bytes; | ||
use rsjudge_traits::language::option::LanguageOption; | ||
|
||
pub struct Source { | ||
pub(crate) language: LanguageOption, | ||
pub(crate) code: Bytes, | ||
} | ||
|
||
impl Source { | ||
pub fn new(language: LanguageOption, code: Bytes) -> Self { | ||
Self { language, code } | ||
} | ||
|
||
pub fn language(&self) -> &LanguageOption { | ||
&self.language | ||
} | ||
|
||
pub fn code(&self) -> &Bytes { | ||
&self.code | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub struct TestCases {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
|
||
pub mod comparer; | ||
|
||
pub use comparer::{CompareResult, Comparer, DefaultComparer}; | ||
pub mod judger; |