I want friends through Rust

I'm a beginner of rust.

I have started to work as a programmer since last November.
I have been coding kotlin and php for developing android application.
After the android application development, I chose Rust for a server-side language of a new project.
So I'm learning Rust.
Rust is not easy, but fun.

What I want to ask you is..
What do you do with rust and why do you use rust?

Thank you.

By the way, I'm from Japan :jp:
(Let me know if my English is kinda weird)

4 Likes

Hi Papillon6814,

I started programming before most people on the planet were born in more languages than I can count anymore.

Rust is not easy, but it is a breath of fresh air compared to almost everything else I have used. It's the first language I have known since starting to use Javascript a few years ago that offers genuinely new features, mainly memory safety without garbage collection and all the borrow checker anti-aliasing rules. That and the performance of C is irresistible.

I have only been looking into Rust, in what little time I have available, over the last year. But already we have Rust services in production use. The main one being a web server using Rocket. This particular thing needs to do a lot of processing of continuous incoming data streams that need a lot fiddly work with bits and bytes to decode into JSON streams for web sockets. The performance of Rust is important for this, such bit twiddling in node.js or Java would be painful.

By the way, I'm from England. Don't worry, everyone's English is kinda weird :slight_smile:

2 Likes

Thank you for replying!

To be honest, I don't know how much the Rust performance is better than node.js and Java ones because of my poor development experience.
Is Rust performance much better than such other languages?

I'm glad to hear the interesting things :grinning:

Yes and no; usually, performance is usually more about how a program is structured than what language it’s written in. Java (and maybe nodejs; I’m not sure) compiles to a bytecode, which has to be translated to machine code at runtime. Rust, like C and C++, produces machine code directly.

For some programs, this extra translation time is important and for others it’s not. The other disadvantage of a bytecode system is that you need to have a runtime system written in some non-bytecode language to do the translation.

1 Like

Thank you for telling me that. :slightly_smiling_face:

Hey there
I'm also a newbie to rust, and to programming in general too at least professionally.

I've been looking into rust for the last 4 - 5 months or so. I made a little chatbot for telegram and also published a very simple library in rust... which is the first time I've ever published anything publicly EVER. The thing I like most about rust is how it ENFORCES good practices, not just allows it. Like how it Forces you to use Mutexes, forces you to deal with Nulls and Errors (Option and Result). It feels to me like rust teaches you to code better, not just rust but everything else.

As for your question about performance, Well I'm no expert, and as 2e71828 said, it depends on your structure rather than the language sometimes, and also sometimes the benefits might not affect your specific use case. However without going much into technical details, a well made rust program can run many times faster than a Java or Python program under many circumstances.

4 Likes

Noice!
I have ever only seen telegram bot in python, so yours is interesting for me.

I want to write a good code in Rust, but I don't know how to do that.
Do you think I can learn it with writing rust code again and again?
Or do you know any more effective ways? :wink:

If you're not in a hurry you could go through the rust book. It covers the basics well.

then I just start making any goofy thing that comes to my head. Making fun things has always been my way of learning.

you could try making a small tic tac toe game in the cli

heck make a telegram bot that makes fun of your friends https://crates.io/crates/telegram-bot

2 Likes

The golden rule is that "performance is what you measure". It's no good making hand waving arguments about the performance of this or that. One has to measure it.

Certainly if your program has to do a lot of calculation or "bit twiddling" it is going to be much slower in interpreted language like Javascript, Python even Java and the like. Which is why I wanted a compiled language for the work I mentioned above.

But you will see a lot of people now working with data analytics and Artificial Intelligence/Deep Learning now a days using Python. That's OK, most of the work in such applications is actually done in libraries which are written in C/C++ and plenty fast enough. The slow Python is only the "glue" between those high speed parts.

Or in a web server, say, if your Javascript/node.js spends most of it's time waiting on your database to answer requests from web clients then it is likely not your bottle neck and plenty fast enough.

2 Likes

Thank you for giving me the link!

I will try to make a goofy fun things with rust :relaxed:

I sometimes see that in quora. There are many things to remember in engineering... How do you get the knowledge? Good engineers know load of things much more than I know.

Hi Papillon6814,

i was using rust at first nearly one year ago to port an experimental software renderer and small gfx lib from plain c into rust. I like programming languages and i was happy about rusts cryptic syntax. My plan is to use rust as layer between C libs until rust will have his own native equivalents.

Have a good time here, this is a really nice and very competent community.

Happy c0ding :slight_smile:

3 Likes

What little I know comes from decades of working in interesting places with engineers far smarter and more knowledgeable than me.

Now a days, we are lucky enough to have a lot of smarter and more knowledgeable people willing to help with our problems here :slight_smile:

Ultimately it comes down to an awful lot of researching and reading and experimenting.

1 Like

Curiosity, primarily. Every time you grapple with a hard problem, you learn a little bit about how things work; that knowledge accumulates over time until it looks overwhelming from the outside. Work towards some goal, solving whatever problems that come up along the way, and other people will treat you as an expert long before you feel like one.

1 Like

Hi!
My interested in Rust was initially fueled by two things:

For a long time I've wanted to try developing my own game netcode library. The languages I knew before, Java and Python, maybe a bit of JavaScript, were a poor fit due to requiring a runtime, being garbage collected and potentially being awkward to actually use in games written in other languages. My two choices at the time were C and C++, but I'm not too fond of either language; manual memory management gives me nothing but headaches.

I was also becoming increasingly frustrated with null pointers and exceptions, Maven/ant/gradle and the dynamic type systems of Python and JS (including, in my opinion, the insufficient solutions provided by mypy and TS), so I was on the lookout for a new language to pick up anyway.

When I found out about Rust in late 2018 it honestly felt like someone had made a language just for me. :sweat_smile: It took a while, but by now I feel very comfortable with the language (advanced lifetimes and unsafe aside) and I'm currently using it at my summer job, personal projects and schoolwork whenever possible.

2 Likes

Thank you for messaging!

Although I'm not familiar with C and C++, I just know Rust has a potential to replace them with it.
Your plan sounds really cool :wink:

Happy coding! :smiley:

1 Like

As you say, my co-worker who often faces difficult problems gets better and better at coding.
I don't give up in rust if I get hard problems :+1:
Thanks :grinning:

Hello @Heliozoa!
Thank you for messaging.

You use Rust for many purposes!
I'm interested in what you do in your projects, for what do you use rust in your projects and schoolwork? I could not use rust in my college... They just allow C, java, python, js, R, so we did not make things with other languages there.

This is what I'm implementing HLS streaming function in Rust.

https://github.com/Papillon-inc/Everlong

It is mostly copy of javelin. Javelin does not have hls function, so I'm trying to get it able to do that.

For example, the instructors of the compilers and code generation courses at my university were kind enough to allow using Rust for the course projects, which were writing an interpreter and a compiler for a toy language. Often there's a "default" language used for a course, and it's at the instructor's discretion to allow other languages to be used.

I'm working on the netcode library I mentioned but it's still in its very early stage, obs-websocket-rs is probably more interesting to look at. It's just a Rust client for communicating with OBS (live streaming program) through obs-websocket.

I actually worked in Japan last year, and our Slack had a Rust channel with some employees on it just for fun, though the company didn't actually use Rust. Hopefully in the future the language can take off in Japan as well :smile:

1 Like