~jplatte/turbo.fish

54389aa0b82f28c1875fd24caac64ed914108368 — Jonas Platte 2 years ago 367fc64
Update all the things!
4 files changed, 31 insertions(+), 34 deletions(-)

M Cargo.toml
M src/main.rs
M src/random.rs
M src/turbofish.rs
M Cargo.toml => Cargo.toml +5 -4
@@ 4,12 4,13 @@ license = "AGPL-3.0+"
name = "turbofish"
repository = "https://github.com/jplatte/turbo.fish"
version = "0.1.0"
edition = "2018"

[dependencies]
rand = "0.3.17"
rocket = "0.3.3"
rocket_codegen = "0.3.3"
rand = "0.5.5"
rocket = "0.3.17"
rocket_codegen = "0.3.17"

[dependencies.rocket_contrib]
version = "0.3.3"
version = "0.3.17"
features = ["tera_templates"]

M src/main.rs => src/main.rs +11 -12
@@ 1,22 1,21 @@
#![feature(non_ascii_idents, plugin)]
#![feature(plugin)]
#![plugin(rocket_codegen)]

extern crate rand;
extern crate rocket;
extern crate rocket_contrib;

mod turbofish;
mod random;
mod turbofish;

use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::{
    collections::HashMap,
    path::{Path, PathBuf},
};

use rocket::http::uri::URI;
use rocket::response::{NamedFile, Redirect};
use rocket::{
    http::uri::URI,
    response::{NamedFile, Redirect},
};
use rocket_contrib::Template;

use random::random_type;
use turbofish::TurboFish;
use self::{random::random_type, turbofish::TurboFish};

#[get("/")]
fn index() -> Template {

M src/random.rs => src/random.rs +14 -16
@@ 36,22 36,20 @@ fn random_type_depth(depth: u8) -> String {
    let (type_name, generics) = rand::thread_rng().choose(TYPES).unwrap();
    if *generics == 0 {
        type_name.to_string()
    } else if depth == RECURSION_LIMIT {
        format!(
            "{}<{}>",
            type_name,
            (0..*generics).map(|_| "_").collect::<Vec<_>>().join(", ")
        )
    } else {
        if depth == RECURSION_LIMIT {
            format!(
                "{}<{}>",
                type_name,
                (0..*generics).map(|_| "_").collect::<Vec<_>>().join(", ")
            )
        } else {
            format!(
                "{}<{}>",
                type_name,
                (0..*generics)
                    .map(|_| random_type_depth(depth + 1))
                    .collect::<Vec<_>>()
                    .join(", ")
            )
        }
        format!(
            "{}<{}>",
            type_name,
            (0..*generics)
                .map(|_| random_type_depth(depth + 1))
                .collect::<Vec<_>>()
                .join(", ")
        )
    }
}

M src/turbofish.rs => src/turbofish.rs +1 -2
@@ 1,5 1,4 @@
use rocket::request::FromParam;
use rocket::http::RawStr;
use rocket::{http::RawStr, request::FromParam};

pub struct TurboFish(String);