pub struct CompilationBuilder {
    pub lang: String,
    /* private fields */
}
Expand description

A builder to allow you to easily build requests

use std::collections::HashSet;
use tokio::macros::*;
use std::error::Error;
use wandbox::{Wandbox, CompilationBuilder};
#[tokio::main]
async fn main() {
   let wbox : Wandbox = match Wandbox::new(None, None).await {
       Ok(wbox) => wbox,
       Err(e) => return println!("{}", e)
   };
   let mut builder = CompilationBuilder::new();
   builder.target("gcc-6.3.0");
   builder.options_str(vec!["-Wall", "-Werror"]);
   builder.code("#include<iostream>\nint main()\n{\nstd::cout<<\"test\";\n}");
   let result = match builder.build(&wbox) {
       Ok(res) => res,
       Err(e) => return println!("{}", e)
   };
}

Fields

lang: String

Implementations

Creates a new CompilationBuilder with default values to be filled in later

Sets the target of the compilation

Arguments
  • target - The target of a compilation, this can be a language (‘c++’), or a compiler (‘gcc-head’)

Sets the code to be compiled

Arguments
  • code - String of code to be compiled

Sets the stdin to directed towards the application

Arguments
  • stdin - program input

Determines whether or not Wandbox saves the compilation & replies with a link for you

Arguments
  • save - true if Wandbox should save this compilation

Sets the list of compilation options. Useful for languages like c++ to pass linker/optimization flags.

Arguments
  • options - A list of compiler options i.e [“-Wall”, “-Werror”]

Sets the list of compilation options. Useful for languages like c++ to pass linker/optimization flags.

This version allows you to pass a Vec<&str>

Arguments
  • options - A list of compiler options i.e [“-Wall”, “-Werror”]

Finalizes the builder & prepares itself for compilation dispatch.

Arguments
  • wb - An instance of the Wandbox cache to resolve the compilation target

Dispatches the built request to Wandbox

Trait Implementations

Returns the “default value” for a type. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more