chiark / gitweb /
Remove most uses of ColouredString::slice().
authorSimon Tatham <anakin@pobox.com>
Tue, 9 Jan 2024 06:37:44 +0000 (06:37 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 10 Jan 2024 07:51:42 +0000 (07:51 +0000)
commit474eea16044bd873861869e208088f5e16eb3c6a
tree97b54a8a107a94090010171c06491cdefe3a7f09
parent7cc91bf4f9d31805cbb629584dd04ad8d13f32ed
Remove most uses of ColouredString::slice().

The new flexibility means we don't have to use an explicit method call
to turn a ColouredString into a ColouredStringSlice before passing it
to ColouredString::push_str().

Also, in tui.rs, ratatui_set_string demonstrates that functions
outside the coloured_string module can also be given the flexibility
to take either an owned ColouredString or a slice, by taking an
argument 'impl ColouredStringCommon'.

However, in FileStatusLineFinal::render_highlighted(), where I pass
ColouredStringSlices to a closure, I _couldn't_ do that - closures are
apparently more restricted than ordinary functions in that way. So
that's the one place where I still had to explicitly call .slice().
src/editor.rs
src/html.rs
src/text.rs
src/tui.rs