Fast-Forward

⏩ Quering lists blazing fast.
This is a very, very, ... early state. This means, this implementation is on the way to find out, what is a good solution and want anyone use it. The API can change a lot! Please, try it out and give me feedback.
Overview
Fast-Forward is a library for finding or filtering items in a (large) collection (Vec, Slice, Map, ...).
This means faster than an Iterator
or a search algorithm.
It is a wrapper, which extends the given collection with very fast find operations.
This wrapper is just as easy to use as the given (original) collection.
This faster is achieved by using Indices
. This means, it does not have to touch and compare every item in the collection.
An Index
has two parts, a Key
(item to searching for) and a Position
(the index) in the collection.
Example for an indexed read only List (ro::IList):
use ;
;
// created an indexed List with the UIntIndex on the Car property 0.
let l = new;
// idx method pointed to the Car.0 property Index and
// gives access to the `Retriever` object to handle queries, like: contains, get, filter.
assert!;
assert!;
// get a Car with the ID = 2
assert_eq!;
// get many Cars with ID = 2 or 1
assert_eq!;
// the same query with the filter-method
// (which has the disadvantage, that this need a allocation)
assert_eq!;
// you can use the Vec methods too
assert_eq!;
// or you can get MetaData like min and max Key value
use MetaData;
assert_eq!;
assert_eq!;
All supported options for retrieve Items can you find by the [crate::collections::Retriever
] struct.
Example for a View
of an indexed read only List (ro::IList):
A View
is like a database view. This means you get a subset of items, which you can see.
It is useful, if you don't want to give full read access to the complete collection.
All details to [crate::collections::Retriever::create_view()
]
use ;
;
// created an indexed List with the MapIndex on the Car property 1.
let l = new;
// create a view: only for Car Name = "BMW" 0r "Audi"
let view = l.idx.create_view;
// Car with Name "VW" is NOT in the view
assert!;
// get the Care with the name "Audi"
assert_eq!;
// the original list contains of course the Car with ID "VW"
assert!;
License: MIT