Commit Graph

37 Commits

Author SHA1 Message Date
Aleksey Kladov
930462df0a Switch to Rust range notation 2020-03-13 10:27:47 +01:00
bors[bot]
e27818ef72 Merge rust-analyzer/text-size#6
6: Alternative set of conversions r=matklad a=matklad

@CAD97 what do yo think about this set of conversions? The idea here is that

* we provide From's for `u32`, because `TextSize` is, transparently, an `u32`. 
* we don't provide other fixed sized conversions -- I don't think I've ever needed them, and `TextSize` is not exactly the number, so forcing the occasional user to two a two step conversion seems OK: first covnersions changes to a raw repr, the second conversion is a numeric cast. This is in contrast two a one-step conversion, which mixes both numeric cast and raw-typed.
* We provide `TryFrom<usize>` (because that can fail) and `Into<usize>` (because that can't fail. If you are on 16bit machine, you probably want to use u16 for TextSize anyway). Unlike stdlib, we can be more aggressive here. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-12 14:42:50 +00:00
Aleksey Kladov
79435fce0e Merge pull request rust-analyzer/text-size#9 from CAD97/textsize-fmt
Remove Display for TextSize
2020-03-12 12:37:16 +01:00
Aleksey Kladov
485351360a Be 16-bit clean 2020-03-12 12:31:37 +01:00
bors[bot]
4b30753238 Merge rust-analyzer/text-size#10
10: fix tests r=CAD97 a=CAD97

---
bors: r+
🤖

Co-authored-by: CAD97 <cad97@cad97.com>
2020-03-12 03:27:34 +00:00
CAD97
c1474fb51b fix tests 2020-03-11 23:27:12 -04:00
CAD97
9ee15a0330 Remove Display for TextSize 2020-03-11 16:13:02 -04:00
Aleksey Kladov
321819447b Provide the same set of impls as stdlib 2020-03-10 14:12:47 +01:00
Aleksey Kladov
28d1e2c4dc Alternative set of conversions 2020-03-10 13:56:50 +01:00
Aleksey Kladov
7e3de30bdc Merge pull request rust-analyzer/text-size#5 from rust-analyzer/ctors
Add a couple of non-canonical ctors
2020-03-10 11:35:04 +01:00
Aleksey Kladov
7577f7a741 Add TextRange::empty 2020-03-10 11:28:14 +01:00
Aleksey Kladov
5694994d6e Merge pull request rust-analyzer/text-size#3 from rust-analyzer/small-things
Remove things
2020-03-10 11:12:02 +01:00
Aleksey Kladov
c770a24091 Document MSRV 2020-03-10 11:11:13 +01:00
Aleksey Kladov
4beaddb3cc Drop unnecessary impl
The impl is valid, but probably not too useful, we can always add it later
2020-03-10 11:11:13 +01:00
Aleksey Kladov
789ba76d67 Remove stray Intos 2020-03-09 16:56:35 +01:00
Aleksey Kladov
18ba8f5d6f Merge pull request rust-analyzer/text-size#4 from rust-analyzer/proper-ranges
Proper ranges
2020-03-09 16:46:34 +01:00
Aleksey Kladov
7d86273066 Tuple-struct ctor is the canonical way to create a ranges 2020-03-09 16:35:30 +01:00
Aleksey Kladov
416606929c Enforce invariant that ranges are well-formed
This is in contrast to `std::ops::Range`, which are not guaranteed to
be proper. For this reason, we have to lose `From` impls as well.
2020-03-09 08:39:40 +01:00
Aleksey Kladov
72aef8ca04 Merge pull request rust-analyzer/text-size#2 from CAD97/text-size
Large refactor: text-size almost-1.0 crate
2020-03-09 08:20:35 +01:00
CAD97
2748c49ebe Scale back the exposed API surface 2020-03-07 22:33:21 -05:00
CAD97
18f7f27e60 Aggressive refactor 2020-03-07 17:10:37 -05:00
Aleksey Kladov
2965e2a1c0 Publish v0.1.10 2020-02-26 10:58:36 +01:00
bors[bot]
8ef25517c9 Merge rust-analyzer/text-size#1
1: Add extend_to for TextRange r=edwin0cheng a=edwin0cheng

~~This PR added a `convex_hull` function for joining to two `TextUnit` together.~~

This PR added a `extend_to` function for joining to two `TextUnit` together.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-02-25 14:56:04 +00:00
Edwin Cheng
54b62a4f03 Rename convex_hull to extend_to 2020-02-25 22:54:31 +08:00
Edwin Cheng
3d9bbe7cb2 Add convex_hull for TextRange 2020-02-25 22:10:21 +08:00
Aleksey Kladov
1b67164899 Add TODOs 2020-02-13 23:09:23 +01:00
Aleksey Kladov
8d0e4f71fc support deepsize 2019-06-02 14:36:29 +03:00
Aleksey Kladov
567e851178 bump version 2019-05-15 19:01:08 +03:00
Aleksey Kladov
d425a125a0 implement RangeBounds for TextRange 2019-05-15 19:00:43 +03:00
Aleksey Kladov
609fb1798f restore lost code =/ 2019-05-15 18:59:55 +03:00
Aleksey Kladov
f0c777726c a couple of utility methods 2018-10-30 21:13:51 +03:00
Aleksey Kladov
cb3dbf29d0 checked ops 2018-08-28 20:58:09 +03:00
Aleksey Kladov
42a9f79ece ranges arithmetics 2018-08-22 11:36:06 +03:00
Aleksey Kladov
66ab7251bf Add inline(always)
It's useful for cross-crate inlining
2018-07-31 21:40:07 +03:00
Aleksey Kladov
7351d29cd4 Add more impls 2018-07-28 11:54:27 +03:00
Aleksey Kladov
b96a808779 CI 2018-06-20 14:44:50 +03:00
Aleksey Kladov
378968b9fc initial 2018-06-20 14:43:05 +03:00