Skip to content

GetSlice can now use both `usize` and `Option<usize>`

Jeremy Soller requested to merge stratact:orbital into orbital

Created by: stratact

  • Along with removing the now deprecated OptionSlice
  • Implemented the AsOption trait for converting either usize or Option<usize> to Option<usize> (credit goes to @LazyOxen for writing out the functionality in the Rust Playpen)

So you can have your 🍰 and eat it too.

The only downsides to doing this are:

  • That you cannot do a usize..Option<usize> or Option<usize>..usize because it's statically dispatched
    • So it must be either usize..usize or Option<usize>..Option<usize>
  • The test!(array.get_slice(..) == &array); test errors, because when using .. ranges, GetSlice needs to know the type parameters explicitly and I didn't feel like with filling it in for now.

But other than that, I Feel Good!

Merge request reports