summary refs log tree commit diff stats
path: root/src/impls/cstr.rs
blob: 5467963fa565c8b29df240b8ebcd0a6261149bb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::ffi::CStr;
use std::os::raw::c_char;

use crate::*;

impl AsLtPtr for CStr {
    type Target = c_char;

    /// Returns the inner pointer to this C string.
    ///
    /// The returned pointer points to a contiguous region of memory terminated
    /// with a 0 byte to represent the end of the string.
    #[inline]
    fn as_lt_ptr(&self) -> ConstLtPtr<'_, c_char> {
        unsafe { ConstLtPtr::from_raw(self.as_ptr()) }
    }
}