#[repr(C)]pub struct String { /* private fields */ }Expand description
Binding to the string type used by Neovim.
Unlike Rust’s String, this type is not guaranteed to contain valid UTF-8
byte sequences, it can contain null bytes, and it is null-terminated.
Implementations§
Source§impl String
impl String
pub fn as_bytes(&self) -> &[u8] ⓘ
Sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Creates a String from a byte slice by allocating bytes.len() + 1
bytes of memory and copying the contents of bytes into it, followed
by a null byte.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of the String, not including the final null byte.
Sourcepub fn to_string_lossy(&self) -> Cow<'_, str>
pub fn to_string_lossy(&self) -> Cow<'_, str>
Converts the String into Rust’s std::string::String. If it already
holds a valid UTF-8 byte sequence no allocation is made. If it doesn’t
the String is copied and all invalid sequences are replaced with �.
Trait Implementations§
Source§impl FromObject for String
impl FromObject for String
Source§impl Ord for String
impl Ord for String
Source§impl PartialOrd for String
impl PartialOrd for String
impl Eq for String
Auto Trait Implementations§
impl Freeze for String
impl RefUnwindSafe for String
impl !Send for String
impl !Sync for String
impl Unpin for String
impl UnwindSafe for String
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.