summaryrefslogtreecommitdiff
path: root/rust/findurl
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2026-02-20 16:17:14 +0100
committerCarlos Maiolino <[email protected]>2026-02-20 16:17:14 +0100
commit4ff0e42f65d8bba3d21bed53bfe1251d8db5c13f (patch)
tree9ac61873e2676c3f392bd26063afeb16897c3902 /rust/findurl
parentfd313dd5ad9ac067a31f2b1760b85bd305567131 (diff)
extra codeHEADmaster
Diffstat (limited to 'rust/findurl')
-rw-r--r--rust/findurl/Cargo.lock7
-rw-r--r--rust/findurl/Cargo.toml6
-rw-r--r--rust/findurl/src/furl.rs7
-rw-r--r--rust/findurl/src/main.rs27
-rw-r--r--rust/findurl/text.txt3
5 files changed, 50 insertions, 0 deletions
diff --git a/rust/findurl/Cargo.lock b/rust/findurl/Cargo.lock
new file mode 100644
index 0000000..e4c345f
--- /dev/null
+++ b/rust/findurl/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "findurl"
+version = "0.1.0"
diff --git a/rust/findurl/Cargo.toml b/rust/findurl/Cargo.toml
new file mode 100644
index 0000000..7a3bc23
--- /dev/null
+++ b/rust/findurl/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "findurl"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
diff --git a/rust/findurl/src/furl.rs b/rust/findurl/src/furl.rs
new file mode 100644
index 0000000..5ce60c1
--- /dev/null
+++ b/rust/findurl/src/furl.rs
@@ -0,0 +1,7 @@
+pub fn find_urls(urls: &mut Vec<String>) -> () {
+
+ urls.push("Ronaldo".to_string());
+ for i in urls {
+ println!("{i}");
+ }
+}
diff --git a/rust/findurl/src/main.rs b/rust/findurl/src/main.rs
new file mode 100644
index 0000000..1723df4
--- /dev/null
+++ b/rust/findurl/src/main.rs
@@ -0,0 +1,27 @@
+mod furl;
+
+fn main() {
+ let mut s = String::new();
+
+ loop {
+
+ match std::io::stdin().read_line(&mut s) {
+ Ok(n) => {
+ if n == 0 {
+ break;
+ }
+ }
+ Err(_) => panic!(),
+ }
+ }
+
+ let mut urls: Vec<String> = Vec::new();
+
+ furl::find_urls(&mut urls);
+
+ for i in &urls {
+ println!("{i}");
+ }
+
+ println!("{}", s);
+}
diff --git a/rust/findurl/text.txt b/rust/findurl/text.txt
new file mode 100644
index 0000000..1c44e9c
--- /dev/null
+++ b/rust/findurl/text.txt
@@ -0,0 +1,3 @@
+https://www.ronaldo.com
+http://www.xproblems.cc
+gopher://gopher.kaboom