#[repr(C)]pub struct String { /* private fields */ }Expand description
Binding to the string type used by Neovim.
Implementations
sourceimpl String
impl String
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 fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [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, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn into_bytes(self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Converts the String into a byte vector, consuming it.
sourcepub fn into_string(self) -> Result<String, FromUtf8Error>
pub fn into_string(self) -> Result<String, 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<'de> Deserialize<'de> for String
impl<'de> Deserialize<'de> for String
sourcefn deserialize<D>(
deserializer: D
) -> Result<String, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<String, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<ContextType> for String
impl From<ContextType> for String
sourcefn from(ctx: ContextType) -> String
fn from(ctx: ContextType) -> String
Converts to this type from the input type.
sourceimpl From<ExtmarkHlMode> for String
impl From<ExtmarkHlMode> for String
sourcefn from(mode: ExtmarkHlMode) -> String
fn from(mode: ExtmarkHlMode) -> String
Converts to this type from the input type.
sourceimpl From<ExtmarkVirtTextPosition> for String
impl From<ExtmarkVirtTextPosition> for String
sourcefn from(pos: ExtmarkVirtTextPosition) -> String
fn from(pos: ExtmarkVirtTextPosition) -> String
Converts to this type from the input type.
sourceimpl From<MouseAction> for String
impl From<MouseAction> for String
sourcefn from(action: MouseAction) -> String
fn from(action: MouseAction) -> String
Converts to this type from the input type.
sourceimpl From<MouseButton> for String
impl From<MouseButton> for String
sourcefn from(action: MouseButton) -> String
fn from(action: MouseButton) -> String
Converts to this type from the input type.
sourceimpl From<OptionScope> for String
impl From<OptionScope> for String
sourcefn from(ctx: OptionScope) -> String
fn from(ctx: OptionScope) -> String
Converts to this type from the input type.
sourceimpl From<RegisterType> for String
impl From<RegisterType> for String
sourcefn from(reg_type: RegisterType) -> String
fn from(reg_type: RegisterType) -> String
Converts to this type from the input type.
sourceimpl FromObject for String
impl FromObject for String
sourceimpl Ord for String
impl Ord for String
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
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>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const 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
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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