Skip to main content

broccoli_server_sdk/types/
submission.rs

1use serde::{Deserialize, Serialize};
2
3/// A named file with content, used for submission files and evaluator source files.
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct SourceFile {
6    pub filename: String,
7    pub content: String,
8}
9
10/// Input to contest type plugin handler's on_submission handler.
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct OnSubmissionInput {
13    pub submission_id: i32,
14    pub user_id: i32,
15    pub problem_id: i32,
16    pub contest_id: Option<i32>,
17    pub files: Vec<SourceFile>,
18    pub language: String,
19    pub time_limit_ms: i32,
20    pub memory_limit_kb: i32,
21    pub problem_type: String,
22}
23
24/// Output from contest type plugin handler.
25///
26/// `success`: whether the submission was processed without errors (not whether it passed).
27/// `error_message`: describes the failure reason when `success` is false.
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct OnSubmissionOutput {
30    pub success: bool,
31    pub error_message: Option<String>,
32}