Learning Rust :safe:

Originally this was the part I was missing, but my question to David was also about what Maidsafe were doing because I wasn’t sure how to reconcile the various explanations, but I’ve a decent picture now.

Your explanation is helpful too, thanks as I’m picking up more of the terminology as I go. ‘Boxed’ is a new one. I’m guessing it relates to Box which I’ve not read up about yet. I think one of the two Rust async books I looked at could do with covering the things you have explained in your post above, because it it an important part of the picture - along with the implications of choosing between the different executors.

This is so atypical (in decades I can’t recall an example like this) that I think it would help if it was covered in the Rust book too.

PS I caused my first panic in libcore yesterday, and how did I manage this - by handling an error in some copied code that originally discarded it with unwrap()! :grimacing:

4 Likes

@JPL, John, sorry for the delay, I had to do a major refactor so logtail can now be built with two different backends, one of which (crossterm) is a step towards Windows support.

So if you are still up for trying this out, please follow the instructions to get the code in the README (here) and then try building for Windows (as shown in a section below that). EDIT: don’t try it yet, as I’ve found something I need to fix first. See below.

I’ve opened github issue #3 where we can track any changes. I’ve no idea if I’ve done everything necessary for this to run on Windows, so let’s see what happens!

EDIT: I’m trying to cross compile and getting the same errors you were John, so I need to do a bit more before you can have another go.

Not vital, but you could try this and verify you can run the tui-rs crossterm example - see this comment. Thanks.

3 Likes

Yaaaaaaaaay, my PR got merged! :tada:

The Rust contributors have been super helpful and I’ve felt very welcome + they’ve responded instantly to my comments (it was almost scary :smile:).

So…if I can get a PR merged into Rust you all can do it too! Just look for something that you think can be improved and open an issue (or directly a PR, if it is a small enough change).

They have a very thorough documentation on how to contribute - I will link it in the wiki. :wink:

Supplementary documentation for members and contributors of the Rust programming language:
https://forge.rust-lang.org/

Documentation on how to contribute to the Rust compiler:
About this guide - Rust Compiler Development Guide

16 Likes

@JPL, John I now have code which cross compiles for Windows which means there’s a decent chance you can build and run it. So if you can, please hop over to this comment for instructions. Thanks!

2 Likes

It works!

The only thing that didn’t work was RUSTFLAGS="-A unused" I note it’s commented out in logtail-crossterm.rs so I’m guessing this is the problem

Running the command without that and everything was hunky dory :clap:

1 Like

Ah yes, thanks for catching that. It’s because of the different command line in Windows.

Blimey, it all worked! Marvelous, thanks very much John. I’ve been making some more changes to the architecture and will start on support for SAFE Vaults soon.

I wonder if it works in MacOS too. Anyone fancy testing it on Mac? If so follow the instructions at GitHub - happybeing/logtail-dash: Terminal dashboard for monitoring logfiles

1 Like

Hi John, no hurry, but when you have a mo please can you test the updated instructions for logtail on Windows which are:

cargo install logtail --bin logtail-crossterm --features="crossterm"
logtail-crossterm --help

This should build the crossterm version (required for Windows) which I guess you can rename or alias to logtail. If this works I’ll close the issue. Thanks again.

I’ve added a section on error handling in Rust to the OP. This includes a link to a superb blog post that will get you up to speed quickly and save you a lot of grief later.

3 Likes

I just started this - it seems great! It is my first language, apart from a month of python on codecademy 3 or 4 years ago, so I’m both terrified and very excited. I will have ten days off from work now at Christmas, have already started, but yes, it seems fabulous, and is made for absolute beginners to coding.

Also, if you sign up to udemy freshly you can get it for 13 euro which is what I paid. Wish me luck!

13 Likes

Good luck! And be sure to ask for help if you need it. The Rust forum and chats are good too, and there’s a Rust book with tutorial. :christmas_tree: Happy Rustmas! :crab:

Link to the free online book and other resources in the OP: Learning Rust :safe:

7 Likes

Ha, I bought the course too! Seemed simple enough. My first programming language apart from BASIC in the mid 1980’s.

Does anyone have a link to a good course that would teach me basics of a computer?

4 Likes

I have ‘The Book’ bookmarked yes, have leafed through a bit, looks pretty comprehensive. I am going to spend a bit of time going through stackoverflow, the forum and chats of the Rust community. That is part of why I think it’s a good choice of language, even if it is a harder than python or whatever there are lots of resources. including yourself Mark and all the other knowledgable Safers here!

2 Likes

Amazing stuff! Good luck! For computer basics I’ve been duckduckgoing as I go so far to find articles, or looking at youtube videos on here https://invidious.snopyta.org there are so many concepts that I know nothing about haha. But luckily, so many excellent short videos and simple articles explaining things. Learned what a compiler does last night :smiley:

2 Likes

I went through the exact same process about five years ago, with a small variation. After 80s BASIC I did try to learn C++ from a book about 15 years ago but found it tough going - there were no free courses back then. Ultimately I gave up, but learned a fair bit about memory allocation, pointers etc.

Luckily, there are many more resources now. Freecodecamp is excellent. I’m OK-ish at basic JavaScript and Python now (although I’m really slow at getting it to stick) and would like to have a go at Rust, just need to wait too be made redundant first :slightly_smiling_face: . Rust might be a tough one as a first -or distant second - language though, despite the resources available, because you’ll have to learn all that memory stuff as well as the usual loops, data structures etc. Anyway, best of luck.

The Computerphile YouTube (or Invidious) channel is a good place for explanations about how computers work.

8 Likes

New years promise:

I’m going to write a short program in Rust. I know already what it is supposed to do. It is very short, very simple, of no use to anyone… but it is my own idea, kind of a joke, and should be simple enough to pull it together even for a total novice after some practice. I’m going to release it here, so stay tuned.

10 Likes

I’ve added a small section about performance and provided a link to the Rust Performance Book. Very interesting read! I consider it to be suitable for intermediate Rustaceans rather than beginners, though. :crab:

I’d also like to include categories like Testing and Benchmarking, but I’m not sure about them, because:

  • for benchmarking, you require tools, so they also fall under the Tools section
  • or are these two categories really one category Testing and Benchmarking Tools
  • oh my :exploding_head:

Any thoughts on this?

For Testing and Benchmarking, I’d like to include the following crates:

3 Likes

I think Tools is a catch all for anything that isn’t big enough for is own section. Maybe rename it to “Other Tools” and add the sections you think it needs?

Thanks for adding to this Jan.

2 Likes

:+1:
I’ve now renamed ToolsOther Tools and created three separate categories beneath:

  • IDEs
  • Testing
  • Benchmarking
2 Likes

Good work. Good for noobs.

The deeper I dig into this the more I like it. “infinte” loops being one!

2 Likes