Giter Site home page Giter Site logo

icodein / hello-world.rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from b4skyx/hello-world.rs

0.0 1.0 0.0 885 KB

πŸš€Memory safe, blazing fast, configurable, minimal hello world written in rust(πŸš€) in a few lines of code with few(1092πŸš€) dependenciesπŸš€

License: Other

Rust 79.35% Makefile 2.52% Dockerfile 1.18% Nix 11.80% Shell 5.15%

hello-world.rs's Introduction

πŸš€ hello-world.rs πŸš€

πŸš€ Memory safe, blazing fast, minimal and configurable hello world project written in the rust(πŸš€) programming language πŸš€

πŸš€ While this depends on more c code than rust(πŸš€) code to compile, because rust(πŸš€) is magically memory safe, now all c code is memory safe too πŸš€

πŸš€ This project is very minimal, it only requires 1092 crates πŸš€

Building

To compile this project you need only one library πŸš€:

1. alsa-lib πŸš€
1. glfw πŸš€
1. freetype πŸš€
1. libglib πŸš€
1. pango πŸš€
1. atk πŸš€
1. pixbuf πŸš€
1. gdk πŸš€

Just 1 lib as you can see the number list along the names πŸš€

You probably have most of them already, if it says something along the words, you know what to search for now

Then you can just make and the compiled executable should be located in ./target/release/hello-world run it or install it with make install .

Due to the lightweightness of rust(πŸš€), unlike node_modules being fairly large for few dependencies, rust(πŸš€) manages compile caches efficiently and stores them to storage to save compile times! Just 33G target folder, the compile time is only around 2 hours and 30 minutes on my mac on release mode

πŸš€

A clean build makes it take around 3.8G

πŸš€

The CPU usage is pretty minimal too (release mode)

πŸš€ πŸš€

πŸš€

It is slower than echo but memory safety comes at a cost! We need to be memory chad and blazing pure and lightning based

Benchmark by cypercine

Installation

Arch Linux

$ makepkg -si
$ pacman -U <package>.pkg.tar.xz

Docker

$ docker build -t hello-world .
$ docker run -it --rm --name hwrs hello-world

Nix

$ nix-env -i -f default.nix

Shade

$ wget "https://raw.githubusercontent.com/mTvare6/hello-world.rs/master/hello-world.rs-buildscript" -O <prefix>/user/main/hello-world.rs
$ shade install hello-world.rs

Why rust(πŸš€) while its only 1 line and depends on 600 c bind crates?

Here are my takes on that matter

C in "c language" stands for cringe and CVE πŸš€

R in "rust(πŸš€) systems programming language" stands for rewrite and robust πŸš€

Here are the comments from few of my fellow Rustaceans πŸš€

People ask the question "what's rust(πŸš€) good for?" pretty frequently, and little terminal apps like this are precisely the reason. [...]. It enables a kind of workflow that simply didn't exist before: I could have a fully safe, "correct", LLVM-optimized binary installed on my desktop in an afternoon.πŸš€

Modern rust(πŸš€) appears pretty similar to modern JavaScript. You declare your variables with letπŸš€

I think it would make rust(πŸš€) more productive if rust(πŸš€) could absorb Python's ecosystem(many mature wheels) as soon as possible.πŸš€

One thing I like about rust(πŸš€) is that it filters out lazy/sloppy thinkers. Even when I disagree with another rust(πŸš€) programmer, there is a certain level of respect that comes from knowing that they thought about the problem deeply enough to pass the borrow checker.πŸš€

The thing I hate about rust(πŸš€) the most is that all the other languages feel extra dumb and annoying once I learned borrowing, lifetimes etc.πŸš€

"I feel like the discovery of rust(πŸš€) is transporting me back to my younger self [...]" "When I started learning rust(πŸš€) in earnest in 2018, I thought this was a fluke. It is just the butterflies you get when you think you fall in love, I told myself."πŸš€

rust(πŸš€)’s product is not a programming language or a compiler. rust(πŸš€)’s product is the experience of being a rust(πŸš€) developerπŸš€

rust(πŸš€) can handle CPU-intensive operations such as executing algorithms. πŸš€

Because it’s typically typed, rust(πŸš€) catches errors at compile time. [...] Also, it compiles code down to machine learning, allowing for extra efficiency.πŸš€

Many people try to compare rust(πŸš€) to Go, but this is flawed. Go is an ancient board game that emphasizes strategy. rust(πŸš€) is more appropriately compared to Chess, a board game focused on low-level tactics.πŸš€

rust(πŸš€)'s unsafe keyword is a critical innovation for information security. I believe that Safe rust(πŸš€) will eventually be a foundational technology for all of human society.πŸš€

I wish I had a compiler (one as informative as rust(πŸš€)'s would be amazing) but for Japanese. If I could learn Japanese the way I learn programming I'd be conversationally fluent by now.πŸš€

rust(πŸš€) held onto it’s spot as the most beloved language among the professional developers we surveyed. That said, the majority of developers who took the survey aren’t familiar with the language.πŸš€

I've experienced modern package management through Cargo and anything below that level now seems like returning to stone age.πŸš€

I probably can write same code in c, but since rust(πŸš€) is rust(πŸš€), I need to (re)write in rust(πŸš€) πŸš€

Wait its only time until rust(πŸš€) makes assembly memroy safe.πŸš€

Done lots of C/C++/Python is the past, just started learning node/JS recently. Just kicked off a rust(πŸš€) tutorial, you people obviously already know this, but rust(πŸš€) is basically all the awesomeness of C++ smashed together with all the awesomeness and dependency management of JS. Looking forward to learning more rust(πŸš€) in the future! πŸš€

All C/C++ devs are absolute fools, they are wasting their time writing c/c++ when instead they could write in rust(πŸš€)!!!!

As a rust(πŸš€) developer, I have no idea how any of this or computers actually works, but its cool to ask people in discord.gg/rust(πŸš€) for all help and write codeπŸš€

hello-world.rs's People

Contributors

b4skyx avatar cravend avatar dazai-osamu-san avatar dylanaraps avatar elkowar avatar exorcist365 avatar fabiololix avatar gitleptune avatar heavyrain266 avatar jaapmarcus avatar legendofmiracles avatar matievisthekat avatar mcotocel avatar mexus avatar mixcoac avatar monosans avatar mtvare6 avatar orhun avatar origincode avatar oschrich avatar overlisting avatar saiintbrisson avatar sickcodes avatar slaynandkorpil avatar torvalds avatar uludev avatar vovw avatar wafelack avatar williamvenner avatar ysthakur avatar

Watchers

 avatar

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.