GithubHelp home page GithubHelp logo

こんにちは世界!

人物描写 🐙

#![allow(non_snake_case)]
const FRAME_CHARACTER: &str = "◼︎";

struct Myself {
    name: String,
    target: String,
    remainingFuel: String,
}

mod beautify {
    use crate::FRAME_CHARACTER;
    pub enum Frame {
        X(usize),
        Y,
    }
    pub fn print_fancy_border(position: Frame, newLine: bool) {
        match position {
            Frame::X(max_repeat) => { print!(" \x1b[93m{}{}\x1b[0m", FRAME_CHARACTER.repeat(max_repeat), { if newLine { "\n" } else { "" } }); }
            Frame::Y => { print!("\x1b[93m{}{}\x1b[0m", FRAME_CHARACTER, { if newLine { "\n" } else { "" } }); }
        }
    }
    pub fn print_beautifully(string_list: &[String]) {
        let longest_line = check_longest(&string_list);
        print_fancy_border(Frame::X(longest_line), true);
        for line in string_list {
            print_fancy_border(Frame::Y, false);
            print!("\x1b[97m{}\x1b[0m{}", line, {
                if line.chars().count() != longest_line {
                    " ".repeat(longest_line - line.chars().count())
                } else {
                    String::default()
                }
            });
            print_fancy_border(Frame::Y, true);
        }
        print_fancy_border(Frame::X(longest_line), true);
    }
    pub fn check_longest(string_list: &[String]) -> usize {
        let mut longest: usize = 0;
        for line in string_list {
            if longest < line.chars().count() {
                longest = line.chars().count();
            }
        }
        longest + 1
    }
}

fn main() {
    // Define my name
    let name: String = String::from("Oscar");
    // Define my target
    let target: String = String::from("Goin' to stars!");
    // Define my remaining fuel
    let remainingFuel: String = String::from("∞");
    // Define myself
    let myself: &Myself = &Myself { name, target, remainingFuel };
    // Show on screen
    {
        let to_display = [
            { String::from(format!(" Hey! My name is {}.", { &myself.name })) },
            { String::from(format!(" {}", &myself.target)) },
            { String::from(format!(" Remaining fuel: {}", { &myself.remainingFuel })) },
        ];
        beautify::print_beautifully(&to_display);
    }
}

入力/出力 🪨

  • Crabs! 🦀
  • Pythonic citizen 🐍
  • Swift-architect 🦉
  • Typescript-poet 📜
  • C-ish dialects in general 🗿

未来 🔭

  • Zig ⚡️
  • OCaml ☯️
  • Kiban 🍱

Oscar's Projects

csidh_but_serde icon csidh_but_serde

A pure Rust CSIDH implementation. This is for research purposes only!

haski icon haski

Also called ハスキー, an experimental hash-powered stock forecaster 👽

kiban icon kiban

The definitive (biased) language 🍜

mars icon mars

Save and load values magically 🪄

singular icon singular

A unique blockchain made by humanity for humanity 🧑‍🚀

superprinter icon superprinter

SuperPrinter is pretty much like print(), but with superpowers 🚀

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.