#[repr(C)]pub struct NvimStr<'a> { /* private fields */ }Expand description
A borrowed version of NvimString.
Values of this type can be created by calling
as_nvim_str on a NvimString or by
converting a CStr.
Implementations§
Source§impl<'a> NvimStr<'a>
impl<'a> NvimStr<'a>
Sourcepub const fn as_bytes(&self) -> &'a [u8] ⓘ
pub const fn as_bytes(&self) -> &'a [u8] ⓘ
Converts the NvimStr into a byte slice, not including the final
null byte.
If you want the final null byte to be included in the slice, use
as_bytes_with_nul instead.
Sourcepub const fn as_bytes_with_nul(&self) -> &'a [u8] ⓘ
pub const fn as_bytes_with_nul(&self) -> &'a [u8] ⓘ
Sourcepub unsafe fn from_raw_parts(data: *const c_char, len: usize) -> Self
pub unsafe fn from_raw_parts(data: *const c_char, len: usize) -> Self
Creates an NvimStr from a pointer to the underlying data and a
length.
§Safety
The caller must ensure that the pointer is valid for len + 1
elements and that the last element is a null byte.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the NvimStr has a length of zero, not including
the final null byte.
Sourcepub const fn len(&self) -> usize
pub const fn len(&self) -> usize
Returns the length of the NvimStr, not including the final null
byte.
Trait Implementations§
Source§impl<'a> From<&'a String> for NvimStr<'a>
impl<'a> From<&'a String> for NvimStr<'a>
Source§fn from(string: &'a NvimString) -> Self
fn from(string: &'a NvimString) -> Self
Converts to this type from the input type.
Source§impl Ord for NvimStr<'_>
impl Ord for NvimStr<'_>
Source§impl PartialOrd for NvimStr<'_>
impl PartialOrd for NvimStr<'_>
impl<'a> Copy for NvimStr<'a>
impl Eq for NvimStr<'_>
Auto Trait Implementations§
impl<'a> Freeze for NvimStr<'a>
impl<'a> RefUnwindSafe for NvimStr<'a>
impl<'a> !Send for NvimStr<'a>
impl<'a> !Sync for NvimStr<'a>
impl<'a> Unpin for NvimStr<'a>
impl<'a> UnwindSafe for NvimStr<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§type Error = Infallible
type Error = Infallible
The error type in the returned
Result.Source§fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
Converts the value into a
Result.