Struct ropey::RopeSlice

source ·
pub struct RopeSlice<'a>(/* private fields */);
Expand description

An immutable view into part of a Rope.

Just like standard &str slices, RopeSlices behave as if the text in their range is the only text that exists. All indexing is relative to the start of their range, and all iterators and methods that return text truncate that text to the range of the slice.

In other words, the behavior of a RopeSlice is always identical to that of a full Rope created from the same text range. Nothing should be surprising here.

Implementations§

source§

impl<'a> RopeSlice<'a>

source

pub fn len_bytes(&self) -> usize

Total number of bytes in the RopeSlice.

Runs in O(1) time.

source

pub fn len_chars(&self) -> usize

Total number of chars in the RopeSlice.

Runs in O(1) time.

source

pub fn len_lines(&self) -> usize

Total number of lines in the RopeSlice.

Runs in O(1) time.

source

pub fn len_utf16_cu(&self) -> usize

Total number of utf16 code units that would be in the RopeSlice if it were encoded as utf16.

Ropey stores text internally as utf8, but sometimes it is necessary to interact with external APIs that still use utf16. This function is primarily intended for such situations, and is otherwise not very useful.

Runs in O(1) time.

source

pub fn byte_to_char(&self, byte_idx: usize) -> usize

Returns the char index of the given byte.

Notes:

  • If the byte is in the middle of a multi-byte char, returns the index of the char that the byte belongs to.
  • byte_idx can be one-past-the-end, which will return one-past-the-end char index.

Runs in O(log N) time.

§Panics

Panics if byte_idx is out of bounds (i.e. byte_idx > len_bytes()).

source

pub fn byte_to_line(&self, byte_idx: usize) -> usize

Returns the line index of the given byte.

Notes:

  • Lines are zero-indexed. This is functionally equivalent to counting the line endings before the specified byte.
  • byte_idx can be one-past-the-end, which will return the last line index.

Runs in O(log N) time.

§Panics

Panics if byte_idx is out of bounds (i.e. byte_idx > len_bytes()).

source

pub fn char_to_byte(&self, char_idx: usize) -> usize

Returns the byte index of the given char.

Notes:

  • char_idx can be one-past-the-end, which will return one-past-the-end byte index.

Runs in O(log N) time.

§Panics

Panics if char_idx is out of bounds (i.e. char_idx > len_chars()).

source

pub fn char_to_line(&self, char_idx: usize) -> usize

Returns the line index of the given char.

Notes:

  • Lines are zero-indexed. This is functionally equivalent to counting the line endings before the specified char.
  • char_idx can be one-past-the-end, which will return the last line index.

Runs in O(log N) time.

§Panics

Panics if char_idx is out of bounds (i.e. char_idx > len_chars()).

source

pub fn char_to_utf16_cu(&self, char_idx: usize) -> usize

Returns the utf16 code unit index of the given char.

Ropey stores text internally as utf8, but sometimes it is necessary to interact with external APIs that still use utf16. This function is primarily intended for such situations, and is otherwise not very useful.

Runs in O(log N) time.

§Panics

Panics if char_idx is out of bounds (i.e. char_idx > len_chars()).

source

pub fn utf16_cu_to_char(&self, utf16_cu_idx: usize) -> usize

Returns the char index of the given utf16 code unit.

Ropey stores text internally as utf8, but sometimes it is necessary to interact with external APIs that still use utf16. This function is primarily intended for such situations, and is otherwise not very useful.

Note: if the utf16 code unit is in the middle of a char, returns the index of the char that it belongs to.

Runs in O(log N) time.

§Panics

Panics if utf16_cu_idx is out of bounds (i.e. utf16_cu_idx > len_utf16_cu()).

source

pub fn line_to_byte(&self, line_idx: usize) -> usize

Returns the byte index of the start of the given line.

Notes:

  • Lines are zero-indexed.
  • line_idx can be one-past-the-end, which will return one-past-the-end byte index.

Runs in O(log N) time.

§Panics

Panics if line_idx is out of bounds (i.e. line_idx > len_lines()).

source

pub fn line_to_char(&self, line_idx: usize) -> usize

Returns the char index of the start of the given line.

Notes:

  • Lines are zero-indexed.
  • line_idx can be one-past-the-end, which will return one-past-the-end char index.

Runs in O(log N) time.

§Panics

Panics if line_idx is out of bounds (i.e. line_idx > len_lines()).

source

pub fn byte(&self, byte_idx: usize) -> u8

Returns the byte at byte_idx.

Runs in O(log N) time.

§Panics

Panics if byte_idx is out of bounds (i.e. byte_idx >= len_bytes()).

source

pub fn char(&self, char_idx: usize) -> char

Returns the char at char_idx.

Runs in O(log N) time.

§Panics

Panics if char_idx is out of bounds (i.e. char_idx >= len_chars()).

source

pub fn line(&self, line_idx: usize) -> RopeSlice<'a>

Returns the line at line_idx.

Note: lines are zero-indexed.

Runs in O(log N) time.

§Panics

Panics if line_idx is out of bounds (i.e. line_idx >= len_lines()).

source

pub fn chunk_at_byte(&self, byte_idx: usize) -> (&'a str, usize, usize, usize)

Returns the chunk containing the given byte index.

Also returns the byte and char indices of the beginning of the chunk and the index of the line that the chunk starts on.

Note: for convenience, a one-past-the-end byte_idx returns the last chunk of the RopeSlice.

The return value is organized as (chunk, chunk_byte_idx, chunk_char_idx, chunk_line_idx).

Runs in O(log N) time.

§Panics

Panics if byte_idx is out of bounds (i.e. byte_idx > len_bytes()).

source

pub fn chunk_at_char(&self, char_idx: usize) -> (&'a str, usize, usize, usize)

Returns the chunk containing the given char index.

Also returns the byte and char indices of the beginning of the chunk and the index of the line that the chunk starts on.

Note: for convenience, a one-past-the-end char_idx returns the last chunk of the RopeSlice.

The return value is organized as (chunk, chunk_byte_idx, chunk_char_idx, chunk_line_idx).

Runs in O(log N) time.

§Panics

Panics if char_idx is out of bounds (i.e. char_idx > len_chars()).

source

pub fn chunk_at_line_break( &self, line_break_idx: usize, ) -> (&'a str, usize, usize, usize)

Returns the chunk containing the given line break.

Also returns the byte and char indices of the beginning of the chunk and the index of the line that the chunk starts on.

Note: for convenience, both the beginning and end of the slice are considered line breaks for the purposes of indexing. For example, in the string "Hello \n world!" 0 would give the first chunk, 1 would give the chunk containing the newline character, and 2 would give the last chunk.

The return value is organized as (chunk, chunk_byte_idx, chunk_char_idx, chunk_line_idx).

Runs in O(log N) time.

§Panics

Panics if line_break_idx is out of bounds (i.e. line_break_idx > len_lines()).

source

pub fn as_str(&self) -> Option<&'a str>

Returns the entire contents of the RopeSlice as a &str if possible.

This is useful for optimizing cases where the slice is only a few characters or words, and therefore has a high chance of being contiguous in memory.

For large slices this method will typically fail and return None because large slices usually cross chunk boundaries in the rope.

(Also see the From impl for converting to a Cow<str>.)

Runs in O(1) time.

source

pub fn slice<R>(&self, char_range: R) -> RopeSlice<'a>
where R: RangeBounds<usize>,

Returns a sub-slice of the RopeSlice in the given char index range.

Uses range syntax, e.g. 2..7, 2.., etc.

Runs in O(log N) time.

§Panics

Panics if the start of the range is greater than the end, or the end is out of bounds (i.e. end > len_chars()).

source

pub fn byte_slice<R>(&self, byte_range: R) -> RopeSlice<'a>
where R: RangeBounds<usize>,

Returns a sub-slice of the RopeSlice in the given byte index range.

Uses range syntax, e.g. 2..7, 2.., etc.

Runs in O(log N) time.

§Panics

Panics if:

  • The start of the range is greater than the end.
  • The end is out of bounds (i.e. end > len_bytes()).
  • The range doesn’t align with char boundaries.
source

pub fn bytes(&self) -> Bytes<'a>

Creates an iterator over the bytes of the RopeSlice.

Runs in O(log N) time.

source

pub fn bytes_at(&self, byte_idx: usize) -> Bytes<'a>

Creates an iterator over the bytes of the RopeSlice, starting at byte byte_idx.

If byte_idx == len_bytes() then an iterator at the end of the RopeSlice is created (i.e. next() will return None).

Runs in O(log N) time.

§Panics

Panics if byte_idx is out of bounds (i.e. byte_idx > len_bytes()).

source

pub fn chars(&self) -> Chars<'a>

Creates an iterator over the chars of the RopeSlice.

Runs in O(log N) time.

source

pub fn chars_at(&self, char_idx: usize) -> Chars<'a>

Creates an iterator over the chars of the RopeSlice, starting at char char_idx.

If char_idx == len_chars() then an iterator at the end of the RopeSlice is created (i.e. next() will return None).

Runs in O(log N) time.

§Panics

Panics if char_idx is out of bounds (i.e. char_idx > len_chars()).

source

pub fn lines(&self) -> Lines<'a>

Creates an iterator over the lines of the RopeSlice.

Runs in O(log N) time.

source

pub fn lines_at(&self, line_idx: usize) -> Lines<'a>

Creates an iterator over the lines of the RopeSlice, starting at line line_idx.

If line_idx == len_lines() then an iterator at the end of the RopeSlice is created (i.e. next() will return None).

Runs in O(log N) time.

§Panics

Panics if line_idx is out of bounds (i.e. line_idx > len_lines()).

source

pub fn chunks(&self) -> Chunks<'a>

Creates an iterator over the chunks of the RopeSlice.

Runs in O(log N) time.

source

pub fn chunks_at_byte( &self, byte_idx: usize, ) -> (Chunks<'a>, usize, usize, usize)

Creates an iterator over the chunks of the RopeSlice, with the iterator starting at the byte containing byte_idx.

Also returns the byte and char indices of the beginning of the first chunk to be yielded, and the index of the line that chunk starts on.

If byte_idx == len_bytes() an iterator at the end of the RopeSlice (yielding None on a call to next()) is created.

The return value is organized as (iterator, chunk_byte_idx, chunk_char_idx, chunk_line_idx).

Runs in O(log N) time.

§Panics

Panics if byte_idx is out of bounds (i.e. byte_idx > len_bytes()).

source

pub fn chunks_at_char( &self, char_idx: usize, ) -> (Chunks<'a>, usize, usize, usize)

Creates an iterator over the chunks of the RopeSlice, with the iterator starting on the chunk containing char_idx.

Also returns the byte and char indices of the beginning of the first chunk to be yielded, and the index of the line that chunk starts on.

If char_idx == len_chars() an iterator at the end of the RopeSlice (yielding None on a call to next()) is created.

The return value is organized as (iterator, chunk_byte_idx, chunk_char_idx, chunk_line_idx).

Runs in O(log N) time.

§Panics

Panics if char_idx is out of bounds (i.e. char_idx > len_chars()).

source

pub fn chunks_at_line_break( &self, line_break_idx: usize, ) -> (Chunks<'a>, usize, usize, usize)

Creates an iterator over the chunks of the RopeSlice, with the iterator starting at the chunk containing line_break_idx.

Also returns the byte and char indices of the beginning of the first chunk to be yielded, and the index of the line that chunk starts on.

Note: for convenience, both the beginning and end of the RopeSlice are considered line breaks for the purposes of indexing. For example, in the string "Hello \n world!" 0 would create an iterator starting on the first chunk, 1 would create an iterator starting on the chunk containing the newline character, and 2 would create an iterator at the end of the RopeSlice (yielding None on a call to next()).

The return value is organized as (iterator, chunk_byte_idx, chunk_char_idx, chunk_line_idx).

Runs in O(log N) time.

§Panics

Panics if line_break_idx is out of bounds (i.e. line_break_idx > len_lines()).

source§

impl<'a> RopeSlice<'a>

§Non-Panicking

The methods in this impl block provide non-panicking versions of RopeSlice’s panicking methods. They return either Option::None or Result::Err() when their panicking counterparts would have panicked.

source

pub fn try_byte_to_char(&self, byte_idx: usize) -> Result<usize>

Non-panicking version of byte_to_char().

source

pub fn try_byte_to_line(&self, byte_idx: usize) -> Result<usize>

Non-panicking version of byte_to_line().

source

pub fn try_char_to_byte(&self, char_idx: usize) -> Result<usize>

Non-panicking version of char_to_byte().

source

pub fn try_char_to_line(&self, char_idx: usize) -> Result<usize>

Non-panicking version of char_to_line().

source

pub fn try_char_to_utf16_cu(&self, char_idx: usize) -> Result<usize>

Non-panicking version of char_to_utf16_cu().

source

pub fn try_utf16_cu_to_char(&self, utf16_cu_idx: usize) -> Result<usize>

Non-panicking version of utf16_cu_to_char().

source

pub fn try_line_to_byte(&self, line_idx: usize) -> Result<usize>

Non-panicking version of line_to_byte().

source

pub fn try_line_to_char(&self, line_idx: usize) -> Result<usize>

Non-panicking version of line_to_char().

source

pub fn get_byte(&self, byte_idx: usize) -> Option<u8>

Non-panicking version of get_byte().

source

pub fn get_char(&self, char_idx: usize) -> Option<char>

Non-panicking version of char().

source

pub fn get_line(&self, line_idx: usize) -> Option<RopeSlice<'a>>

Non-panicking version of line().

source

pub fn try_chunk_at_byte( &self, byte_idx: usize, ) -> Result<(&'a str, usize, usize, usize)>

Non-panicking version of chunk_at_byte().

source

pub fn get_chunk_at_char( &self, char_idx: usize, ) -> Option<(&'a str, usize, usize, usize)>

Non-panicking version of chunk_at_char().

source

pub fn get_chunk_at_line_break( &self, line_break_idx: usize, ) -> Option<(&'a str, usize, usize, usize)>

Non-panicking version of chunk_at_line_break().

source

pub fn get_slice<R>(&self, char_range: R) -> Option<RopeSlice<'a>>
where R: RangeBounds<usize>,

Non-panicking version of slice().

source

pub fn get_byte_slice<R>(&self, byte_range: R) -> Option<RopeSlice<'a>>
where R: RangeBounds<usize>,

Non-panicking version of byte_slice().

source

pub fn get_bytes_at(&self, byte_idx: usize) -> Option<Bytes<'a>>

Non-panicking version of bytes_at().

source

pub fn get_chars_at(&self, char_idx: usize) -> Option<Chars<'a>>

Non-panicking version of chars_at().

source

pub fn get_lines_at(&self, line_idx: usize) -> Option<Lines<'a>>

Non-panicking version of lines_at().

source

pub fn get_chunks_at_byte( &self, byte_idx: usize, ) -> Option<(Chunks<'a>, usize, usize, usize)>

Non-panicking version of chunks_at_byte().

source

pub fn get_chunks_at_char( &self, char_idx: usize, ) -> Option<(Chunks<'a>, usize, usize, usize)>

Non-panicking version of chunks_at_char().

source

pub fn get_chunks_at_line_break( &self, line_break_idx: usize, ) -> Option<(Chunks<'a>, usize, usize, usize)>

Non-panicking version of chunks_at_line_break().

Trait Implementations§

source§

impl<'a> Clone for RopeSlice<'a>

source§

fn clone(&self) -> RopeSlice<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for RopeSlice<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Display for RopeSlice<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a str> for RopeSlice<'a>

Creates a RopeSlice directly from a string slice.

The useful applications of this are actually somewhat narrow. It is intended primarily as an aid when implementing additional functionality on top of Ropey, where you may already have access to a rope chunk and want to directly create a RopeSlice from it, avoiding the overhead of going through the slicing APIs.

Although it is possible to use this to create RopeSlices from arbitrary strings, doing so is not especially useful. For example, Ropes and RopeSlices can already be directly compared for equality with strings and string slices.

Runs in O(N) time, where N is the length of the string slice.

source§

fn from(text: &'a str) -> Self

Converts to this type from the input type.
source§

impl<'a> From<RopeSlice<'a>> for Cow<'a, str>

Attempts to borrow the contents of the slice, but will convert to an owned string if the contents is not contiguous in memory.

Runs in best case O(1), worst case O(N).

source§

fn from(s: RopeSlice<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<RopeSlice<'a>> for Rope

Will share data where possible.

Runs in O(log N) time.

source§

fn from(s: RopeSlice<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<RopeSlice<'a>> for String

source§

fn from(s: RopeSlice<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> Hash for RopeSlice<'a>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a> Ord for RopeSlice<'a>

source§

fn cmp(&self, other: &RopeSlice<'a>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<'a, 'b> PartialEq<&'b str> for RopeSlice<'a>

source§

fn eq(&self, other: &&'b str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<Cow<'b, str>> for RopeSlice<'a>

source§

fn eq(&self, other: &Cow<'b, str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<Rope> for RopeSlice<'a>

source§

fn eq(&self, other: &Rope) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<RopeSlice<'a>> for &'b str

source§

fn eq(&self, other: &RopeSlice<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<RopeSlice<'a>> for Cow<'b, str>

source§

fn eq(&self, other: &RopeSlice<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<RopeSlice<'a>> for Rope

source§

fn eq(&self, other: &RopeSlice<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<RopeSlice<'a>> for String

source§

fn eq(&self, other: &RopeSlice<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<RopeSlice<'a>> for str

source§

fn eq(&self, other: &RopeSlice<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<RopeSlice<'b>> for RopeSlice<'a>

source§

fn eq(&self, other: &RopeSlice<'b>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<String> for RopeSlice<'a>

source§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<str> for RopeSlice<'a>

source§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialOrd<RopeSlice<'b>> for RopeSlice<'a>

source§

fn partial_cmp(&self, other: &RopeSlice<'b>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> Copy for RopeSlice<'a>

source§

impl<'a> Eq for RopeSlice<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RopeSlice<'a>

§

impl<'a> RefUnwindSafe for RopeSlice<'a>

§

impl<'a> Send for RopeSlice<'a>

§

impl<'a> Sync for RopeSlice<'a>

§

impl<'a> Unpin for RopeSlice<'a>

§

impl<'a> UnwindSafe for RopeSlice<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.