Call playground with /execute and not the legacy /evaluate.json
This commit changes the url used to call the playground, and the request parameter format to go with it. The older evaluate is available in the playground as a form of backwards compatibility and swithcing now opens way for using newer features.
This commit is contained in:
parent
911683d2cf
commit
3823fc0e74
|
@ -358,22 +358,24 @@ function run_rust_code(code_block) {
|
||||||
result_block = code_block.find(".result");
|
result_block = code_block.find(".result");
|
||||||
}
|
}
|
||||||
|
|
||||||
let text = playpen_text(code_block);;
|
let text = playpen_text(code_block);
|
||||||
|
|
||||||
var params = {
|
var params = {
|
||||||
version: "stable",
|
channel: "stable",
|
||||||
optimize: "0",
|
mode: "debug",
|
||||||
|
crateType: "bin",
|
||||||
|
tests: false,
|
||||||
code: text,
|
code: text,
|
||||||
};
|
}
|
||||||
|
|
||||||
if(text.indexOf("#![feature") !== -1) {
|
if(text.indexOf("#![feature") !== -1) {
|
||||||
params.version = "nightly";
|
params.channel = "nightly";
|
||||||
}
|
}
|
||||||
|
|
||||||
result_block.text("Running...");
|
result_block.text("Running...");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "https://play.rust-lang.org/evaluate.json",
|
url: "https://play.rust-lang.org/execute",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
crossDomain: true,
|
crossDomain: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
@ -381,7 +383,7 @@ function run_rust_code(code_block) {
|
||||||
data: JSON.stringify(params),
|
data: JSON.stringify(params),
|
||||||
timeout: 15000,
|
timeout: 15000,
|
||||||
success: function(response){
|
success: function(response){
|
||||||
result_block.text(response.result);
|
result_block.text(response.success ? response.stdout : response.stderr);
|
||||||
},
|
},
|
||||||
error: function(qXHR, textStatus, errorThrown){
|
error: function(qXHR, textStatus, errorThrown){
|
||||||
result_block.text("Playground communication " + textStatus);
|
result_block.text("Playground communication " + textStatus);
|
||||||
|
|
Loading…
Reference in New Issue