about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-18 16:50:54 -0700
committerGitHub <noreply@github.com>2020-07-18 16:50:54 -0700
commitf305b200df5af87608677f30c272f47cf2210623 (patch)
treec476911c7e60d8128ebd76eb49651c2c875000a0 /library/std/src/sys/unix/stack_overflow.rs
parenta6266e2d606802b8e9e326dee6410f914959e546 (diff)
parent30b8835d1d0f531aa1d5875cde5ffae347177fd3 (diff)
downloadrust-f305b200df5af87608677f30c272f47cf2210623.tar.gz
rust-f305b200df5af87608677f30c272f47cf2210623.zip
Rollup merge of #74021 - 1011X:master, r=dtolnay
impl Index<RangeFrom> for CStr

This change implements (partial) slicing for `CStr`.

Since a `CStr` must end in a null byte, it's not possible to trim from the right and still have a valid `CStr`. But, it *is* possible to trim from the left. This lets us be a bit more flexible and treat them more like strings.

```rust
let string = CStr::from_bytes_with_nul(b"Hello World!\0");
let result = CStr::from_bytes_with_nul(b"World!\0");
assert_eq!(&string[6..], result);
```
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions