Skip to content

Commit

Permalink
Add new status field to ExecResponse
Browse files Browse the repository at this point in the history
Update piston_rs req to 0.4+
  • Loading branch information
Jonxslays committed Dec 14, 2021
1 parent 46b6249 commit 3883b96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ crate-type = ["cdylib"]
pyo3 = { version = "0.14", features = ["extension-module"] }
pyo3-asyncio = { version = "0.14", features = ["tokio-runtime"] }
tokio = { version = "1" }
piston_rs = "^0.3.0"
piston_rs = "^0.4.0"
3 changes: 3 additions & 0 deletions piston_rspy/piston_rspy.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ class ExecResponse:
compile: `ExecResult | None`
The optional result Piston sends detailing compilation.
This will be `None` for non-compiled languages.
status: `int`
The response status returned by Piston.
Raises:
`TypeError`: If the class is instantiated manually.
Expand All @@ -175,6 +177,7 @@ class ExecResponse:
version: str
run: ExecResult
compile: ExecResult | None
status: int
def is_ok(self) -> bool:
"""Whether or not the request to Piston succeeded.
Expand Down
6 changes: 6 additions & 0 deletions src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ impl ExecResponse {
self.inner.compile.as_ref().map(ExecResult::from_result)
}

/// `int`: The response status returned by Piston.
#[getter]
fn status(&self) -> u16 {
self.inner.status
}

/// Whether or not the request to Piston succeeded.
///
/// ### Returns:
Expand Down

0 comments on commit 3883b96

Please sign in to comment.