diff options
author | Jordan Gong <jordan@inspiron-n4050.localdomain> | 2020-08-04 08:53:28 +0800 |
---|---|---|
committer | Jordan Gong <jordan@inspiron-n4050.localdomain> | 2020-08-04 08:53:28 +0800 |
commit | 0e05964fff11e3add0937e8288ebd3ec33b53fd0 (patch) | |
tree | 79ebf69533801fe5d40646e74fdd98b86bdbd36f /hello-rust/src | |
parent | f3ddd7930bf3a976419836b57a9f0f1197913e9d (diff) |
Say hello
Diffstat (limited to 'hello-rust/src')
-rw-r--r-- | hello-rust/src/main.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/hello-rust/src/main.rs b/hello-rust/src/main.rs new file mode 100644 index 0000000..c6a8c27 --- /dev/null +++ b/hello-rust/src/main.rs @@ -0,0 +1,11 @@ +use ferris_says::say; +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(); +} |