rust/library/core/src/str
bors 4f4dae055b Auto merge of #112387 - clarfonthey:non-panicking-ceil-char-boundary, r=m-ou-se
Don't panic in ceil_char_boundary

Implementing the alternative mentioned in this comment: https://github.com/rust-lang/rust/issues/93743#issuecomment-1579935853

Since `floor_char_boundary` will always work (rounding down to the length of the string is possible), it feels best for `ceil_char_boundary` to not panic either. However, the semantics of "rounding up" past the length of the string aren't very great, which is why the method originally panicked in these cases.

Taking into account how people are using this method, it feels best to simply return the end of the string in these cases, so that the result is still a valid char boundary.
2023-08-15 13:49:24 +00:00
..
converts.rs Add invalid_from_utf8 analogous to invalid_from_utf8_unchecked 2023-05-27 00:18:28 +02:00
count.rs Make some usize-typed masks definition agnostic to the size of usize 2022-04-15 17:04:59 +02:00
error.rs remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
iter.rs Clarify logic on bytes:code units ratio 2023-07-21 23:49:31 +02:00
lossy.rs Expose Utf8Lossy as Utf8Chunks 2022-08-20 12:49:20 -04:00
mod.rs Auto merge of #112387 - clarfonthey:non-panicking-ceil-char-boundary, r=m-ou-se 2023-08-15 13:49:24 +00:00
pattern.rs Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
traits.rs Work around missing <*str>::len 2023-07-31 11:42:14 -07:00
validations.rs Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00