Struct nvim_types::String
source · [−]#[repr(C)]pub struct String { /* private fields */ }Expand description
A particular string type used internally by Neovim.
Implementations
sourceimpl String
impl String
sourcepub fn from_bytes(vec: Vec<u8>) -> Self
pub fn from_bytes(vec: Vec<u8>) -> Self
Creates a String from a byte vector.
sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Returns true if the String has a length of zero, and false
otherwise.
sourcepub const fn len(&self) -> usize
pub const fn len(&self) -> usize
Returns the byte length of the String, not including the final null
byte.
sourcepub const fn as_ptr(&self) -> *const c_char
pub const fn as_ptr(&self) -> *const c_char
Returns a pointer pointing to the byte of the string.
sourcepub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns a byte slice of this String’s contents.
sourcepub fn as_str(&self) -> Result<&str, Utf8Error>
pub fn as_str(&self) -> Result<&str, Utf8Error>
Returns a string slice of this String’s contents. Fails if it doesn’t
contain a valid UTF-8 byte sequence.
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 �.
sourcepub fn into_bytes(self) -> Vec<u8>
pub fn into_bytes(self) -> Vec<u8>
Converts the String into a byte vector, consuming it.
sourcepub fn into_string(self) -> Result<StdString, FromUtf8Error>
pub fn into_string(self) -> Result<StdString, FromUtf8Error>
Converts the String into Rust’s std::string::String, consuming it.
Fails if it doesn’t contain a valid UTF-8 byte sequence.
Trait Implementations
sourceimpl From<String> for Object
impl From<String> for Object
sourcefn from(string: NvimString) -> Self
fn from(string: NvimString) -> Self
Converts to this type from the input type.
sourceimpl Ord for String
impl Ord for String
sourceimpl PartialOrd<String> for String
impl PartialOrd<String> for String
sourcefn partial_cmp(&self, other: &String) -> Option<Ordering>
fn partial_cmp(&self, other: &String) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl TryFrom<Object> for NvimString
impl TryFrom<Object> for NvimString
impl Eq for String
impl StructuralEq 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more