forked from Comamoca/Awesome-DDSK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Comamoca#16 from mochi-sann/add-rust-version
add Rust version
- Loading branch information
Showing
5 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "ddsk" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
rand = "0.8.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM rust:1.62.1 | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN cargo build --release | ||
|
||
ENTRYPOINT ["/app/target/release/ddsk"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Rust | ||
## 実行方法 | ||
|
||
`cargo run` | ||
|
||
|
||
## Docker | ||
|
||
``` | ||
docker build . -t ddsk:rust | ||
docker run --rm ddsk:rust | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
extern crate rand; | ||
use rand::Rng; | ||
|
||
fn main() { | ||
let mut rng = rand::thread_rng(); | ||
|
||
let ddsk: [&str; 2] = ["ドド", "スコ"]; | ||
let ddsk_temp: &str = "ドドスコスコスコドドスコスコスコドドスコスコスコ"; | ||
let mut text: String = "".to_string(); | ||
loop { | ||
let add_text: &str = ddsk[rng.gen_range(0..2)]; | ||
print!("{}", add_text); | ||
text = String::from(text) + add_text; | ||
if text.contains(ddsk_temp) { | ||
print!("ラブ注入♡"); | ||
break; | ||
} | ||
} | ||
} |