master > master: src - rust
This commit is contained in:
1
code/rust/src/core/mod.rs
Normal file
1
code/rust/src/core/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod utils;
|
||||
25
code/rust/src/core/utils.rs
Normal file
25
code/rust/src/core/utils.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
// ----------------------------------------------------------------
|
||||
// IMPORTS
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
extern crate regex;
|
||||
|
||||
use self::regex::Regex;
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// METHODS get regex
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
/// Constructs RegEx and panics if error.
|
||||
pub fn construct_regex(pattern: &str) -> Regex {
|
||||
return Regex::new(pattern)
|
||||
.expect("Invalid regex construction!");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// METHOD hello world
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
pub fn greet() {
|
||||
println!("Hello world!");
|
||||
}
|
||||
1
code/rust/src/lib.rs
Normal file
1
code/rust/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod core;
|
||||
15
code/rust/src/main.rs
Normal file
15
code/rust/src/main.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
// ----------------------------------------------------------------
|
||||
// IMPORTS
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
extern crate ads2;
|
||||
|
||||
use ads2::core::utils;
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// MAIN METHOD
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
fn main() {
|
||||
utils::greet();
|
||||
}
|
||||
Reference in New Issue
Block a user