I'm an old programmer, but I keep updated.
I several years I've already programmed in Cobol, C, SuperMumps, Clipper, Basic, Pascal, Linux Bash, PHP, Zim, MySql database, Firebird database, SuperMumps, Clipper, Basic, Delphi, Oracle, Python, Golang
I made a lot of softwares in all this years - utilities, stock exchange analytics, complete business softwares.
Recent Languages:
Python - I love - I miss an easy and fast compiler, but I've made a lot of softwares.
GoLang - Excelent ! I've made a lot of softwares.
Rust - I loved the packages and the Speed to compile and run. It seems also secure in terms of memory use, etc
I made a GUI software in Rust with fltk and it works, but I'm thinking in abandon Rust, because it's the most difficult language I already used. (syntax)
The learning curve it's the worst I've seen.
I'm taking 40 times more times to get the my code working than another languages.
I got in crates.io, get recent packages, copy the sample source code and a lot of source code does NOT work!!!
(http curl and a lot of another codes)
I never see so many errors in another languages I've used.
Rust have a good future, but needs to improve the documentation and create easier ways to write code (easier syntax)
Let's see all the errors that I have now in my Rust software:
error[E0015]: cannot call non-const fn `<sysinfo::System as SystemExt>::disks` in constants
--> rustprg1.rs:463:28
|
463 | let mut discos: [str; sys.disks().len()] = [0; sys.disks().len()];
| ^^^^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot call non-const fn `<sysinfo::System as SystemExt>::new_all` in constants
--> rustprg1.rs:455:31
|
455 | const sys: sysinfo::System = System::new_all();
| ^^^^^^^^^^^^^^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0493]: destructor of `sysinfo::System` cannot be evaluated at compile-time
--> rustprg1.rs:463:24
|
463 | let mut discos: [str; sys.disks().len()] = [0; sys.disks().len()];
| ^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> rustprg1.rs:463:18
|
463 | let mut discos: [str; sys.disks().len()] = [0; sys.disks().len()];
| ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: slice and array elements must have `Sized` type
error[E0015]: cannot call non-const fn `<sysinfo::System as SystemExt>::disks` in constants
--> rustprg1.rs:463:53
|
463 | let mut discos: [str; sys.disks().len()] = [0; sys.disks().len()];
| ^^^^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0493]: destructor of `sysinfo::System` cannot be evaluated at compile-time
--> rustprg1.rs:463:49
|
463 | let mut discos: [str; sys.disks().len()] = [0; sys.disks().len()];
| ^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0308]: mismatched types
--> rustprg1.rs:463:46
|
463 | let mut discos: [str; sys.disks().len()] = [0; sys.disks().len()];
| ^ expected `str`, found integer
error[E0277]: the trait bound `str: std::marker::Copy` is not satisfied
--> rustprg1.rs:463:46
|
463 | let mut discos: [str; sys.disks().len()] = [0; sys.disks().len()];
| ^ the trait `std::marker::Copy` is not implemented for `str`
|
= note: the `Copy` trait is required because this value will be copied for each element of the array
error[E0425]: cannot find function `len` in this scope
--> rustprg1.rs:464:16
|
464 | println!("{}",len(discos));
| ^^^ not found in this scope
Some errors have detailed explanations: E0015, E0277, E0308, E0425, E0493.
For more information about an error, try `rustc --explain E0015`.
error: could not compile (rustprg1.rs") due to 9 previous errors
Another pieces of code that I'm having problem:
let name="John"+" Doe";
let nromac="";
for (interface_name, network) in networks {
if network.mac_address().to_string() != "00:00:00:00:00:00" && network.mac_address().to_string() != "" {
let nromac=network.mac_address().to_string();
let mut nromac=nroaux;
}
}
println!("MAC {}", nromac);
// (nromac outside the for gets Null)
this code below works, but does not work in a function:
fn getdatafromcmd(fcomando: &str) -> String {
let resultado = Command::new("cmd")
.arg("/C")
.arg(fcomando)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
.expect("failed to execute process")
result resultado;
}