From 4ff0e42f65d8bba3d21bed53bfe1251d8db5c13f Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Fri, 20 Feb 2026 16:17:14 +0100 Subject: extra code --- rust/findurl/Cargo.lock | 7 +++++++ rust/findurl/Cargo.toml | 6 ++++++ rust/findurl/src/furl.rs | 7 +++++++ rust/findurl/src/main.rs | 27 +++++++++++++++++++++++++++ rust/findurl/text.txt | 3 +++ 5 files changed, 50 insertions(+) create mode 100644 rust/findurl/Cargo.lock create mode 100644 rust/findurl/Cargo.toml create mode 100644 rust/findurl/src/furl.rs create mode 100644 rust/findurl/src/main.rs create mode 100644 rust/findurl/text.txt (limited to 'rust/findurl') 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) -> () { + + 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 = 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 -- cgit v1.2.3