11#![ deny( rust_2018_idioms) ]
22
3- use crate :: env:: { PLAYGROUND_GITHUB_TOKEN , PLAYGROUND_UI_ROOT } ;
43use orchestrator:: coordinator:: CoordinatorFactory ;
5- use serde:: { Deserialize , Serialize } ;
64use snafu:: prelude:: * ;
75use std:: {
86 net:: SocketAddr ,
@@ -20,9 +18,12 @@ const DEFAULT_COORDINATORS_WEBSOCKET_LIMIT: usize = 50;
2018mod env;
2119mod gist;
2220mod metrics;
21+ mod public_http_api;
2322mod request_database;
2423mod server_axum;
2524
25+ use env:: { PLAYGROUND_GITHUB_TOKEN , PLAYGROUND_UI_ROOT } ;
26+
2627fn main ( ) {
2728 // Dotenv may be unable to load environment variables, but that's ok in production
2829 let _ = dotenv:: dotenv ( ) ;
@@ -327,208 +328,3 @@ enum Error {
327328}
328329
329330type Result < T , E = Error > = :: std:: result:: Result < T , E > ;
330-
331- #[ derive( Debug , Clone , Serialize ) ]
332- struct ErrorJson {
333- error : String ,
334- }
335-
336- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
337- struct CompileRequest {
338- target : String ,
339- #[ serde( rename = "assemblyFlavor" ) ]
340- assembly_flavor : Option < String > ,
341- #[ serde( rename = "demangleAssembly" ) ]
342- demangle_assembly : Option < String > ,
343- #[ serde( rename = "processAssembly" ) ]
344- process_assembly : Option < String > ,
345- channel : String ,
346- mode : String ,
347- #[ serde( default ) ]
348- edition : String ,
349- #[ serde( rename = "crateType" ) ]
350- crate_type : String ,
351- tests : bool ,
352- #[ serde( default ) ]
353- backtrace : bool ,
354- code : String ,
355- }
356-
357- #[ derive( Debug , Clone , Serialize ) ]
358- struct CompileResponse {
359- success : bool ,
360- #[ serde( rename = "exitDetail" ) ]
361- exit_detail : String ,
362- code : String ,
363- stdout : String ,
364- stderr : String ,
365- }
366-
367- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
368- struct ExecuteRequest {
369- channel : String ,
370- mode : String ,
371- #[ serde( default ) ]
372- edition : String ,
373- #[ serde( rename = "crateType" ) ]
374- crate_type : String ,
375- tests : bool ,
376- #[ serde( default ) ]
377- backtrace : bool ,
378- code : String ,
379- }
380-
381- #[ derive( Debug , Clone , Serialize ) ]
382- struct ExecuteResponse {
383- success : bool ,
384- #[ serde( rename = "exitDetail" ) ]
385- exit_detail : String ,
386- stdout : String ,
387- stderr : String ,
388- }
389-
390- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
391- struct FormatRequest {
392- #[ serde( default ) ]
393- channel : Option < String > ,
394- #[ serde( default ) ]
395- edition : String ,
396- code : String ,
397- }
398-
399- #[ derive( Debug , Clone , Serialize ) ]
400- struct FormatResponse {
401- success : bool ,
402- #[ serde( rename = "exitDetail" ) ]
403- exit_detail : String ,
404- code : String ,
405- stdout : String ,
406- stderr : String ,
407- }
408-
409- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
410- struct ClippyRequest {
411- #[ serde( default ) ]
412- channel : Option < String > ,
413- #[ serde( default = "default_crate_type" , rename = "crateType" ) ]
414- crate_type : String ,
415- #[ serde( default ) ]
416- edition : String ,
417- code : String ,
418- }
419-
420- #[ derive( Debug , Clone , Serialize ) ]
421- struct ClippyResponse {
422- success : bool ,
423- exit_detail : String ,
424- stdout : String ,
425- stderr : String ,
426- }
427-
428- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
429- struct MiriRequest {
430- code : String ,
431- #[ serde( default ) ]
432- edition : String ,
433- }
434-
435- #[ derive( Debug , Clone , Serialize ) ]
436- struct MiriResponse {
437- success : bool ,
438- exit_detail : String ,
439- stdout : String ,
440- stderr : String ,
441- }
442-
443- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
444- struct MacroExpansionRequest {
445- code : String ,
446- #[ serde( default ) ]
447- edition : String ,
448- }
449-
450- #[ derive( Debug , Clone , Serialize ) ]
451- struct MacroExpansionResponse {
452- success : bool ,
453- exit_detail : String ,
454- stdout : String ,
455- stderr : String ,
456- }
457-
458- #[ derive( Debug , Clone , PartialEq , Serialize ) ]
459- struct CrateInformation {
460- name : String ,
461- version : String ,
462- id : String ,
463- }
464-
465- #[ derive( Debug , Clone , PartialEq , Serialize ) ]
466- struct MetaCratesResponse {
467- crates : Arc < [ CrateInformation ] > ,
468- }
469-
470- #[ derive( Debug , Clone , PartialEq , Serialize ) ]
471- struct MetaVersionsResponse {
472- stable : MetaChannelVersionResponse ,
473- beta : MetaChannelVersionResponse ,
474- nightly : MetaChannelVersionResponse ,
475- }
476-
477- #[ derive( Debug , Clone , PartialEq , Serialize ) ]
478- struct MetaChannelVersionResponse {
479- rustc : MetaVersionResponse ,
480- rustfmt : MetaVersionResponse ,
481- clippy : MetaVersionResponse ,
482- #[ serde( skip_serializing_if = "Option::is_none" ) ]
483- miri : Option < MetaVersionResponse > ,
484- }
485-
486- #[ derive( Debug , Clone , PartialEq , Serialize ) ]
487- struct MetaVersionResponse {
488- version : Arc < str > ,
489- hash : Arc < str > ,
490- date : Arc < str > ,
491- }
492-
493- #[ derive( Debug , Clone , Deserialize ) ]
494- struct MetaGistCreateRequest {
495- code : String ,
496- }
497-
498- #[ derive( Debug , Clone , Serialize ) ]
499- struct MetaGistResponse {
500- id : String ,
501- url : String ,
502- code : String ,
503- }
504-
505- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
506- struct EvaluateRequest {
507- version : String ,
508- optimize : String ,
509- code : String ,
510- #[ serde( default ) ]
511- edition : String ,
512- #[ serde( default ) ]
513- tests : bool ,
514- }
515-
516- #[ derive( Debug , Clone , Serialize ) ]
517- struct EvaluateResponse {
518- result : String ,
519- error : Option < String > ,
520- }
521-
522- impl From < gist:: Gist > for MetaGistResponse {
523- fn from ( me : gist:: Gist ) -> Self {
524- MetaGistResponse {
525- id : me. id ,
526- url : me. url ,
527- code : me. code ,
528- }
529- }
530- }
531-
532- fn default_crate_type ( ) -> String {
533- "bin" . into ( )
534- }
0 commit comments