https://github.com/sudo-self/hello-rust
Rust-APP template
https://github.com/sudo-self/hello-rust
Last synced: 3 months ago
JSON representation
Rust-APP template
- Host: GitHub
- URL: https://github.com/sudo-self/hello-rust
- Owner: sudo-self
- Created: 2023-08-21T06:37:57.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-22T01:52:17.000Z (almost 3 years ago)
- Last Synced: 2025-01-24T14:47:00.795Z (over 1 year ago)
- Language: Makefile
- Homepage:
- Size: 2.68 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hello-rust
### INSTALL RUST ON MACos AND CREAT A NEW PROJECT
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
stable-aarch64-apple-darwin installed
### RELOAD SHELL TO INCLUDE CARGO
source "$HOME/.cargo/env"
### START A NEW PROJECT
Cargo new hello-rust
Created binary (application) `hello-rust` package
Cargo.toml = metadata
Src/main.rs = application code
cd hello-rust
cargo run
Compiling hello-rust v0.1.0 (/Users/admin/hello-rust)
Finished dev [unoptimized + debuginfo] target(s) in 0.68s
Running `target/debug/hello-rust`
Hello World!
### Adding Dependencies
cargo add ferris-says@0.2
Updating crates.io index
Adding ferris-says v0.2 to dependencies.
Features as of v0.2.0:
- clippy
Updating crates.io index
### Add the following line to “main.rs”
use ferris_says::say;
Cargo build
### Application written in main.rs
use ferris_says::say; // from the previous step
use std::io::{stdout, BufWriter};
fn main() {
let stdout = stdout();
let message = String::from("Hello fellow Rustaceans!");
let width = message.chars().count();
let mut writer = BufWriter::new(stdout.lock());
say(message.as_bytes(), width, &mut writer).unwrap();
Cargo run
> cargo run ~/hello-rust(main✗)@JesseJesse.local
Compiling hello-rust v0.1.0 (/Users/admin/hello-rust)
Finished dev [unoptimized + debuginfo] target(s) in 0.56s
Running `target/debug/hello-rust`
__________________________
< Hello fellow Rustaceans! >
--------------------------
\
\
_~^~^~_
\) / o o \ (/
'_ - _'
/ '-----' \
>
