From 7f1c1efe474851a129e4a2e5bc012d9b76ed2ed0 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Sun, 3 Jul 2016 17:00:00 -0700 Subject: Grid API is now generic and strongly typed The Grid no longer knows about a `Cell` and is instead generic. The `Cell` type is coupled to the `term` module already, and it's been moved there to reflect the strong relationship. Grid APIs previously accepted `usize` for many arguments. If the caller intended rows to be columns, but the function accepted them in reverse, there would be no compiler error. Now there is, and this should prevent such bugs from entering the code. The Grid internals grew significantly to accomodate the strongly typed APIs. There is now a `grid::index` module which defines Cursor, Line, and Column. The Grid APIs are all based on these types now. Indexing for Ranges proved to be somewhat awkward. A new range had to be constructed in the implementation. If the optimizer can't figure out what's going on in that case, the ranges may not be a zero-cost abstraction. --- src/main.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index aae02322..e73ec15c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,8 @@ #![feature(inclusive_range_syntax)] #![feature(drop_types_in_const)] #![feature(unicode)] +#![feature(zero_one)] +#![feature(step_trait)] #![feature(custom_derive, plugin)] #![plugin(serde_macros)] -- cgit v1.2.3-54-g00ecf