]> git.cworth.org Git - rust-learning/log
rust-learning
18 hours agoReturn an actual value from main
Carl Worth [Tue, 10 Mar 2026 01:52:58 +0000 (18:52 -0700)]
Return an actual value from main

This is a more idiomatic behavior from main, using a Result to return
either the unit type (which will cause a return of 0) or else an Error
(coerced from a string by using .into()). In that case, the program
will print "Error: " and our error string before exiting with a value
of 1.

18 hours agoSwitch from hello world to a program that prints a usage string
Carl Worth [Tue, 10 Mar 2026 00:04:39 +0000 (17:04 -0700)]
Switch from hello world to a program that prints a usage string

OK, so it's not much more than "hello, world", but it just show how to
use std::env as well as Vec<String> and even has an actual condition
in it! It's almost like real programming now.

Oh, and of course there's the collect() call which showcases both an
iterator and the magic of rust's type inference here (telling
collect() to return a Vec<string>). So, there's quite a bit of rust
here, even for just a tiny block of code.

18 hours agoRename package from "server" to "chip-timing-server"
Carl Worth [Tue, 10 Mar 2026 00:02:57 +0000 (17:02 -0700)]
Rename package from "server" to "chip-timing-server"

The "server" name was appropriate for the directory we are in,
(underneath the chip-timing directory), but it's excessively vague for
an actual compiled binary name. So use chip-timing-server instead.

18 hours agoserver: Add the most minimal rust program possible
Carl Worth [Mon, 9 Mar 2026 23:08:44 +0000 (16:08 -0700)]
server: Add the most minimal rust program possible

This is just the "hello, world" program one gets from running
"cargo init server" (which is literally what I did here).

I also added the .gitignore file for files that will be
generated by "cargo run".