This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 -1 -2 -3 | |
-1 1 0 -1 | |
-2 0 0 1 | |
. ← ← ← | |
↑ ↖ ← ← | |
↑ ↑ ↖ ↖ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cargo test | |
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell) | |
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements | |
--> src/needleman_wunsch.rs:30:2 | |
| | |
30 | fn align<'a, 'b>(&'a self, vec: &'a Vec<T>, similarity: &'b Fn(&T, &T) -> i64, gap_penalty: i64) -> (Vec<Option<&'a T>>, Vec<Option<&'a T>>) { | |
| ^ | |
| | |
help: consider using an explicit lifetime parameter as shown: fn align<'c, 'a, | |
'b>(&'a self, vec: &'a Vec<T>, similarity: &'b Fn(&T, &T) -> i64, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: no method named `max_elem` found for type `[{integer}; 6]` in the current scope | |
--> src/max_elem.rs:34:17 | |
| | |
34 | let m = array.max_elem(); | |
| ^^^^^^^^ | |
| | |
= help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `max_elem`, perhaps you need to implement it: | |
= help: candidate #1: `max_elem::MaxElem` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell) | |
error: `i` does not live long enough | |
--> src/convex_hull.rs:231:15 | |
| | |
229 | (0..5).into_iter().map(|j| { | |
| --- capture occurs here | |
230 | let j = j as f64; | |
231 | Point::new(i, j) | |
| ^ does not live long enough | |
232 | }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::cmp::Ordering::Equal; | |
use std::cmp::Ordering; | |
use std::ops::{Add, Sub, Mul}; | |
use std::collections::BTreeSet; | |
#[derive(Debug, Copy, Clone)] | |
struct Point { | |
x: f64, | |
y: f64, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::cmp::Ordering::Equal; | |
use std::cmp::Ordering; | |
use std::ops::{Add, Sub, Mul}; | |
use std::collections::BTreeSet; | |
#[derive(Debug, Copy, Clone)] | |
struct Point { | |
x: f64, | |
y: f64, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cargo test | |
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell) | |
error[E0119]: conflicting implementations of trait `std::cmp::PartialEq<&convex_hull::Point>` for type `&convex_hull::Point`: | |
--> src/convex_hull.rs:28:1 | |
| | |
28 | impl<'a> PartialEq for &'a Point { | |
| ^ | |
| | |
= note: conflicting implementation in crate `core` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell) | |
error[E0308]: mismatched types | |
--> src/convex_hull.rs:167:10 | |
| | |
167 | set | |
| ^^^ expected struct `convex_hull::Point`, found reference | |
... | |
175 | let minus_i = points.difference(&(btreeset!(p_i))); | |
| -------------- in this macro invocation | |
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell) | |
error[E0277]: the trait bound `&std::collections::HashSet<convex_hull::Point>: std::iter::IntoIterator` is not satisfied | |
--> src/convex_hull.rs:155:2 | |
| | |
155 | for p_i in points { | |
| ^ trait `&std::collections::HashSet<convex_hull::Point>: std::iter::IntoIterator` not satisfied | |
| | |
= help: the following implementations were found: | |
= help: <&'a std::collections::HashSet<T, S> as std::iter::IntoIterator> | |
= help: <std::collections::HashSet<T, S> as std::iter::IntoIterator> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! A simple parser for a tiny subset of CSS. | |
//! | |
//! To support more CSS syntax, it would probably be easiest to replace this | |
//! hand-rolled parser with one based on a library or parser generator. | |
use std::ascii::AsciiExt; // for `to_ascii_lowercase` | |
// Data structures: | |
#[derive(Debug)] |