#[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 PartialEq<&str> for String
impl PartialEq<&str> for String
source§impl PartialEq<String> for &str
impl PartialEq<String> for &str
source§impl PartialEq<String> for String
impl PartialEq<String> for String
source§impl PartialEq<String> for str
impl PartialEq<String> for str
source§impl PartialEq for String
impl PartialEq for String
source§impl PartialOrd for String
impl PartialOrd for String
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for String
Auto Trait Implementations§
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