NeuroFlow
NeuroFlow copied to clipboard
example not compiles(((
error[E0277]: the trait bound `Result<DataSet, Box<dyn std::error::Error>>: Extractable` is not satisfied
| .train(&data, 20_000);
| ^^^^^ the trait `Extractable` is not implemented for `Result<DataSet, Box<dyn std::error::Error>>`
...
rust: stable-x86_64-unknown-linux-gnu installed - rustc 1.52.1 (9bc8c42bb 2021-05-09)
Sorry to hear that , @221V 😞
I'd like to help but I totally forgot Rustlang. So, I have to ask a help of the community
Seems like you edited the example just a little. Please show the whole code
@andrei-lus, no, i take example 'Classic XOR' as-is, just try again --
$ cargo --version
cargo 1.52.0 (69767412a 2021-04-21)
$ cargo build
Updating crates.io index
Downloaded proc-macro2 v1.0.29
Downloaded serde_derive v1.0.130
Downloaded serde v1.0.130
Downloaded serde_json v1.0.68
Downloaded libc v0.2.102
Downloaded syn v1.0.76
Downloaded neuroflow v0.1.3
Downloaded memchr v2.4.1
Downloaded itoa v0.4.8
Downloaded 9 crates (1.2 MB) in 1.55s
Compiling serde v1.0.130
Compiling proc-macro2 v1.0.29
Compiling memchr v2.4.1
Compiling ryu v1.0.5
Compiling libc v0.2.102
Compiling unicode-xid v0.2.2
Compiling syn v1.0.76
Compiling itoa v0.4.8
Compiling regex-automata v0.1.10
Compiling serde_derive v1.0.130
Compiling serde_json v1.0.68
Compiling lazy_static v1.4.0
Compiling byteorder v1.4.3
Compiling quote v1.0.9
Compiling csv-core v0.1.10
Compiling rand v0.4.6
Compiling rand v0.3.23
Compiling bstr v0.2.16
Compiling bincode v0.9.2
Compiling csv v1.1.6
Compiling neuroflow v0.1.3
Compiling neuro v0.1.0 (/home/user/git/neuro)
error[E0277]: the trait bound `Result<DataSet, Box<dyn std::error::Error>>: Extractable` is not satisfied
--> src/main.rs:23:16
|
23 | .train(&data, 20_000);
| ^^^^^ the trait `Extractable` is not implemented for `Result<DataSet, Box<dyn std::error::Error>>`
error[E0599]: no method named `len` found for enum `Result<DataSet, Box<dyn std::error::Error>>` in the current scope
--> src/main.rs:27:22
|
27 | for i in 0..data.len(){
| ^^^ method not found in `Result<DataSet, Box<dyn std::error::Error>>`
error[E0599]: no method named `get` found for enum `Result<DataSet, Box<dyn std::error::Error>>` in the current scope
--> src/main.rs:28:28
|
28 | res = nn.calc(data.get(i).0)[0];
| ^^^ method not found in `Result<DataSet, Box<dyn std::error::Error>>`
error[E0599]: no method named `get` found for enum `Result<DataSet, Box<dyn std::error::Error>>` in the current scope
--> src/main.rs:29:18
|
29 | d = data.get(i);
| ^^^ method not found in `Result<DataSet, Box<dyn std::error::Error>>`
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `neuro`
To learn more, run the command again with --verbose.
and i used other NN.
The trait Extractable
is implemented for DataSet
but your data
variable has type Result<DataSet, Box<dyn std::error::Error>>
, if you use .unwrap()
you'd get a DataSet
or a runtime panic if your data
variable was containing an error