#[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 i8, len: usize) -> NvimStr<'a>
pub unsafe fn from_raw_parts(data: *const i8, len: usize) -> NvimStr<'a>
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 Ord for NvimStr<'_>
impl Ord for NvimStr<'_>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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.