c_str: Add new method .as_str() -> Option<&str>

Also rustify .as_bytes(), so it no longer calls libc::strlen() and is
inlineable.
auto merge of #9220 : kballard/rust/c_str-as_str, r=thestinger

Also rustify .as_bytes(), so it no longer calls libc::strlen() and is
inlineable.