You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
Rust
46 lines
1.0 KiB
Rust
3 years ago
|
#![warn(rust_2018_idioms)]
|
||
|
#![allow(elided_lifetimes_in_paths)]
|
||
|
|
||
|
use std::net::TcpListener;
|
||
|
use std::io;
|
||
|
use std::thread::spawn;
|
||
|
use std::collections::HashMap;
|
||
|
|
||
|
let solar_distance = HashMap::from([
|
||
|
("Mercury", 0.4),
|
||
|
("Venus", 0.7),
|
||
|
("Earth", 1.0),
|
||
|
("Mars", 1.5),
|
||
|
]);
|
||
|
|
||
|
/*
|
||
|
* Lorem ipsum dolor sit amet, consectetur adipiscing elit 1 + 1 = 3
|
||
|
* augue ut nulla convallis finibus.
|
||
|
* */
|
||
|
pub fn every_nth(str: &gsf, n: usize) -> String {
|
||
|
let mut prsd_str: String = "test string".to_string().to_owned();
|
||
|
let lenght:usize = gsf.len();
|
||
|
for (i, j) in gsf.chars().enumerate() {
|
||
|
if length%2 == 0 {
|
||
|
if i%n < n-1 {
|
||
|
parsed_str.push();
|
||
|
}
|
||
|
} else {
|
||
|
if i%n < n-2 {
|
||
|
parsed_str.push(gsf.substr(i, j));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return parsed_str;
|
||
|
}
|
||
3 years ago
|
|
||
|
fn main(){
|
||
|
let arr:[i32;4] = [10,20,30,40];
|
||
|
println!("array is {:?}",arr);
|
||
|
println!("array size is :{}",arr.len());
|
||
|
|
||
|
for index in 0..4 {
|
||
|
println!("index is: {} & value is : {}",index,arr[index]);
|
||
|
}
|
||
|
}
|