Compare commits
2 Commits
08c16eb17f
...
1e232f50f5
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e232f50f5 | |||
| 183f098911 |
10
src/lib.rs
10
src/lib.rs
@@ -55,7 +55,6 @@
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// fn main() {
|
||||
///
|
||||
/// let table = vec![MyPair{ a: 10, b:34}, MyPair{ a: 1, b:56}, MyPair{ a: 2, b:23}];
|
||||
///
|
||||
@@ -73,7 +72,6 @@
|
||||
/// "lex sort [MyPair { a: 1, b: 56 }, MyPair { a: 10, b: 34 }, MyPair { a: 2, b: 23 }]");
|
||||
/// assert_eq!(format!("num sort {:?}", num_sort),
|
||||
/// "num sort [MyPair { a: 1, b: 56 }, MyPair { a: 2, b: 23 }, MyPair { a: 10, b: 34 }]");
|
||||
/// }
|
||||
/// ```
|
||||
pub trait Record<K> {
|
||||
/// Extract the key from the record.
|
||||
@@ -104,14 +102,14 @@ pub trait RecordFields<F> {
|
||||
// semantic order
|
||||
pub trait Indexed<R, K> {
|
||||
/// Retrieve all records matching the key.
|
||||
fn find(&self, key: &K) -> Vec<&R>;
|
||||
fn find<'i>(&'i self, key: &K) -> Box<dyn Iterator<Item = &R> + 'i>;
|
||||
|
||||
/// Retrieve all records matching in the key range defined by
|
||||
/// `start` and `end`.
|
||||
///
|
||||
/// * `start` is included
|
||||
// TODO: TBC for `end`
|
||||
fn find_range(&self, start: &K, end: &K) -> Vec<&R>;
|
||||
fn find_range<'i>(&'i self, start: &K, end: &K) -> Box<dyn Iterator<Item = &R> + 'i>;
|
||||
}
|
||||
|
||||
/// Methods provided by destructuring indices.
|
||||
@@ -123,12 +121,12 @@ pub trait Indexed<R, K> {
|
||||
/// * `K`: Type of the keys
|
||||
pub trait IndexedDestructured<F, K> {
|
||||
/// Retrieve all records matching the key.
|
||||
fn find(&self, key: &K) -> Vec<&F>;
|
||||
fn find<'i>(&'i self, key: &K) -> Box<dyn Iterator<Item = &F> + 'i>;
|
||||
|
||||
/// Retrieve all records matching in the key range defined by
|
||||
/// `start` and `end`.
|
||||
///
|
||||
/// * `start` is included
|
||||
// TODO: TBC for `end`
|
||||
fn find_range(&self, start: &K, end: &K) -> Vec<(K, &F)>;
|
||||
fn find_range<'i>(&'i self, start: &K, end: &K) -> Box<dyn Iterator<Item = (K, &F)> + 'i>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user