Struct basic_text::TextStr

source ·
pub struct TextStr(/* private fields */);
Expand description

Text slices.

TextStr is to TextString as str is to String. It is usually used for borrowing, in the form of &TextStr.

§Examples

Text literals are text slices:

use basic_text::{text, TextStr};

let hello = text!("Hello, world!");

// with an explicit type annotation
let hello: &'static TextStr = text!("Hello, world!");

They are ’static because they’re stored directly in the final binary, and so will be valid for the ’static duration.

Implementations§

source§

impl TextStr

source

pub fn from_text_bytes(b: &[u8]) -> Result<&Self, TextError>

Converts a slice of bytes to a text string slice.

source

pub fn from_text(s: &str) -> Result<&Self, TextError>

Converts a string slice to a text string slice.

source

pub fn from_text_bytes_mut(b: &mut [u8]) -> Result<&mut Self, TextError>

Converts a mutable slice of bytes to a mutable text string slice.

source

pub fn from_text_mut(s: &mut str) -> Result<&mut Self, TextError>

Converts a mutable string slice to a mutable text string slice.

source

pub unsafe fn from_text_bytes_unchecked(b: &[u8]) -> &Self

Converts a slice of bytes to a text string slice without checking that the string contains valid Basic Text.

§Safety

This function is unsafe because it does not check that the bytes passed to it are valid Basic Text. If this constraint is violated, undefined behavior results, as the rest of this crate assumes that &TextStrs are valid Basic Text.

source

pub unsafe fn from_text_unchecked(s: &str) -> &Self

Converts a string slice to a text string slice without checking that the string contains valid Basic Text.

§Safety

This function is unsafe because it does not check that the bytes passed to it are valid Basic Text. If this constraint is violated, undefined behavior results, as the rest of this crate assumes that &TextStrs are valid Basic Text.

source

pub unsafe fn from_text_bytes_unchecked_mut(b: &mut [u8]) -> &mut Self

Converts a slice of bytes to a text string slice without checking that the string contains valid Basic Text; mutable version.

§Safety

This function is unsafe because it does not check that the bytes passed to it are valid Basic Text. If this constraint is violated, undefined behavior results, as the rest of this crate assumes that &TextStrs are valid Basic Text.

source

pub unsafe fn from_text_unchecked_mut(s: &mut str) -> &mut Self

Converts a string slice to a text string slice without checking that the string contains valid Basic Text; mutable version.

§Safety

This function is unsafe because it does not check that the string passed to it is valid Basic Text. If this constraint is violated, undefined behavior results, as the rest of this crate assumes that &TextStrs are valid Basic Text.

source

pub unsafe fn from_boxed_text_bytes_unchecked(v: Box<[u8]>) -> Box<Self>

Converts a boxed slice of bytes to a boxed text string slice without checking that the string contains valid basic text.

§Safety

This function is unsafe because it does not check that the bytes passed to it are valid Basic Text. If this constraint is violated, undefined behavior results, as the rest of this crate assumes that &TextStrs are valid Basic Text.

source

pub unsafe fn from_boxed_text_unchecked(v: Box<str>) -> Box<Self>

Converts a boxed string slice to a boxed text string slice without checking that the string contains valid basic text.

§Safety

This function is unsafe because it does not check that the bytes passed to it are valid Basic Text. If this constraint is violated, undefined behavior results, as the rest of this crate assumes that &TextStrs are valid Basic Text.

source

pub const fn len(&self) -> usize

Returns the length of self.

source

pub const fn is_empty(&self) -> bool

Returns true if self has a length of zero bytes.

source

pub const fn as_bytes(&self) -> &[u8]

Converts a text string slice to a byte slice.

source

pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8]

Converts a mutable text string slice to a mutable byte slice.

§Safety

The caller must ensure that the content of the slice is valid Basic Text before the borrow ends and the underlying TextStr is used.

Use of a TextStr whose contents are not valid Basic Text is undefined behavior.

source

pub const fn as_ptr(&self) -> *const u8

Converts a text string slice to a raw pointer.

source

pub fn as_mut_ptr(&mut self) -> *mut u8

Converts a mutable text string slice to a raw pointer.

source

pub fn as_str(&self) -> &str

Extracts a UTF-8 string slice containing the entire TextStr.

source

pub fn split_at(&self, mid: usize) -> (&Self, &Self)

Divide one text string slice into two at an index.

source

pub fn split_at_mut(&mut self, mid: usize) -> (&mut Self, &mut Self)

Divide one mutable text string slice into two at an index.

source

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

Returns an iterator over the chars of a text string slice.

source

pub fn char_indices(&self) -> CharIndices<'_>

Returns an iterator over the chars of a text string slice, and their positions.

source

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

An iterator over the bytes of a text string slice.

source

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

An iterator over the lines of a text string, as text string slices.

TODO: There should be a TextLines which yields &TextStrs.

source

pub fn encode_utf16(&self) -> EncodeUtf16<'_>

Returns an iterator of u16 over the string encoded as Basic Text.

source

pub fn contains<'a, P>(&'a self, pat: P) -> bool
where P: Pattern<'a>,

Returns true if the given pattern matches a sub-slice of this text string slice.

Returns false if it does not.

source

pub fn starts_with<'a, P>(&'a self, pat: P) -> bool
where P: Pattern<'a>,

Returns true if the given pattern matches a prefix of this text string slice.

Returns false if it does not.

source

pub fn ends_with<'a, P>(&'a self, pat: P) -> bool
where P: Pattern<'a>, <P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,

Returns true if the given pattern matches a suffix of this text string slice.

Returns false if it does not.

source

pub fn find<'a, P>(&'a self, pat: P) -> Option<usize>
where P: Pattern<'a>,

Returns the byte index of the first character of this text string slice that matches the pattern.

Returns None if the pattern doesn’t match.

source

pub fn rfind<'a, P>(&'a self, pat: P) -> Option<usize>
where P: Pattern<'a>, <P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,

Returns the byte index for the first character of the rightmost match of the pattern in this text string slice.

Returns None if the pattern doesn’t match.

source

pub fn matches<'a, P>(&'a self, pat: P) -> Matches<'a, P>
where P: Pattern<'a>,

An iterator over the disjoint matches of a pattern within the given text string slice.

source

pub fn rmatches<'a, P>(&'a self, pat: P) -> RMatches<'a, P>
where P: Pattern<'a>, <P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,

An iterator over the disjoint matches of a pattern within this text string slice, yielded in reverse order.

TODO: There should be a TextRMatches which yields &TextStrs.

source

pub fn match_indices<'a, P>(&'a self, pat: P) -> MatchIndices<'a, P>
where P: Pattern<'a>,

An iterator over the disjoint matches of a pattern within this text string slice as well as the index that the match starts at.

TODO: There should be a TextMatchIndices which yields &TextStrs.

source

pub fn rmatch_indices<'a, P>(&'a self, pat: P) -> RMatchIndices<'a, P>
where P: Pattern<'a>, <P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,

An iterator over the disjoint matches of a pattern within self, yielded in reverse order along with the index of the match.

TODO: There should be a TextRMatchIndices which yields &TextStrs.

source

pub fn trim(&self) -> &Self

Returns a text string slice with leading and trailing whitespace removed.

source

pub fn trim_start(&self) -> &Self

Returns a text string slice with leading whitespace removed.

source

pub fn trim_end(&self) -> &Self

Returns a text string slice with trailing whitespace removed.

source

pub fn parse<F>(&self) -> Result<F, <F as FromStr>::Err>
where F: FromStr,

Parses this text string slice into another type.

source

pub fn is_ascii(&self) -> bool

Checks if all characters in this text string are within the ASCII range.

source

pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool

Checks that two text strings are an ASCII case-insensitive match.

source

pub fn into_boxed_bytes(self: Box<Self>) -> Box<[u8]>

Converts a Box<TextStr> into a Box<[u8]> without copying or allocating.

source

pub fn into_boxed_text(self: Box<Self>) -> Box<str>

Converts a Box<TextStr> into a Box<str> without copying or allocating.

source

pub fn into_string(self: Box<Self>) -> String

Converts a Box<TextStr> into a String without copying or allocating.

source

pub fn into_text_string(self: Box<Self>) -> TextString

Converts a Box<TextStr> into a TextString without copying or allocating.

source

pub fn repeat(&self, n: usize) -> TextString

Creates a new TextString by repeating a string n times.

source

pub fn escape_debug(&self) -> EscapeDebug<'_>

Return an iterator that escapes each char in self with char::escape_debug.

source

pub fn escape_default(&self) -> EscapeDefault<'_>

Return an iterator that escapes each char in self with char::escape_default.

source

pub fn escape_unicode(&self) -> EscapeUnicode<'_>

Return an iterator that escapes each char in self with char::escape_unicode.

Trait Implementations§

source§

impl Add<&TextStr> for TextString

§

type Output = TextString

The resulting type after applying the + operator.
source§

fn add(self, other: &TextStr) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<&TextStr> for TextString

source§

fn add_assign(&mut self, other: &TextStr)

Performs the += operation. Read more
source§

impl AsMut<TextStr> for TextString

source§

fn as_mut(&mut self) -> &mut TextStr

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[u8]> for TextStr

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<OsStr> for TextStr

source§

fn as_ref(&self) -> &OsStr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Path> for TextStr

source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<TextStr> for TextStr

source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<TextStr> for TextString

source§

fn as_ref(&self) -> &TextStr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<TextSubstr> for TextStr

source§

fn as_ref(&self) -> &TextSubstr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<str> for TextStr

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<TextStr> for TextString

source§

fn borrow(&self) -> &TextStr

Immutably borrows from an owned value. Read more
source§

impl BorrowMut<TextStr> for TextString

source§

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

Mutably borrows from an owned value. Read more
source§

impl Clone for Box<TextStr>

source§

fn clone(&self) -> Self

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 Debug for TextStr

source§

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

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

impl Default for &TextStr

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Default for &mut TextStr

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Default for Box<TextStr>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for TextStr

source§

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

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

impl<'a> Extend<&'a TextStr> for TextString

source§

fn extend<I: IntoIterator<Item = &'a TextStr>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, s: &'a TextStr)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl From<&TextStr> for Box<TextStr>

source§

fn from(s: &TextStr) -> Self

Converts to this type from the input type.
source§

impl From<&TextStr> for TextString

source§

fn from(s: &TextStr) -> Self

Converts to this type from the input type.
source§

impl From<&mut TextStr> for TextString

source§

fn from(s: &mut TextStr) -> Self

Converts to this type from the input type.
source§

impl From<Cow<'_, TextStr>> for Box<TextStr>

source§

fn from(cow: Cow<'_, TextStr>) -> Self

Converts to this type from the input type.
source§

impl From<TextString> for Box<TextStr>

source§

fn from(s: TextString) -> Self

Converts to this type from the input type.
source§

impl Hash for TextStr

source§

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

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

impl Index<Range<usize>> for TextStr

§

type Output = TextSubstr

The returned type after indexing.
source§

fn index(&self, index: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeFrom<usize>> for TextStr

§

type Output = TextSubstr

The returned type after indexing.
source§

fn index(&self, index: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeTo<usize>> for TextStr

§

type Output = TextSubstr

The returned type after indexing.
source§

fn index(&self, index: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Ord for TextStr

source§

fn cmp(&self, other: &Self) -> Ordering

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

impl<'a, 'b> PartialEq<&'b TextStr> for Cow<'a, TextStr>

source§

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

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

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

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

impl<'a, 'b> PartialEq<&'b TextStr> for Cow<'a, TextSubstr>

source§

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

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

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

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

impl<'a, 'b> PartialEq<&'b TextStr> for Cow<'a, str>

source§

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

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

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

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

impl<'a> PartialEq<&'a TextStr> for String

source§

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

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

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

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

impl<'a> PartialEq<&'a TextStr> for TextString

source§

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

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

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

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

impl<'a> PartialEq<&'a TextStr> for TextSubstring

source§

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

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

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

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

impl<'a, 'b> PartialEq<Cow<'a, TextStr>> for &'b TextStr

source§

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

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

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

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

impl<'a> PartialEq<Cow<'a, TextStr>> for TextStr

source§

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

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

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

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

impl<'a, 'b> PartialEq<Cow<'a, TextSubstr>> for &'b TextStr

source§

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

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

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

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

impl<'a, 'b> PartialEq<Cow<'a, str>> for &'b TextStr

source§

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

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

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

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

impl<'a> PartialEq<Cow<'a, str>> for TextStr

source§

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

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

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

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

impl<'a> PartialEq<String> for &'a TextStr

source§

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

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

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

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

impl PartialEq<String> for TextStr

source§

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

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

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

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

impl<'a> PartialEq<TextStr> for Cow<'a, TextStr>

source§

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

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

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

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

impl<'a> PartialEq<TextStr> for Cow<'a, TextSubstr>

source§

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

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

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

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

impl<'a> PartialEq<TextStr> for Cow<'a, str>

source§

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

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

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

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

impl PartialEq<TextStr> for String

source§

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

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

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

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

impl PartialEq<TextStr> for TextString

source§

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

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

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

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

impl PartialEq<TextStr> for TextSubstring

source§

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

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

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

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

impl PartialEq<TextStr> for str

source§

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

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

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

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

impl<'a> PartialEq<TextString> for &'a TextStr

source§

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

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

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

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

impl PartialEq<TextString> for TextStr

source§

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

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

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

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

impl<'a> PartialEq<TextSubstring> for &'a TextStr

source§

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

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

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

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

impl PartialEq<TextSubstring> for TextStr

source§

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

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

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

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

impl PartialEq<str> for TextStr

source§

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

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

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

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

impl PartialEq for TextStr

source§

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

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

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

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

impl PartialOrd for TextStr

source§

fn partial_cmp(&self, other: &Self) -> 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

This method 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

This method 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

This method 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

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

impl ToOwned for TextStr

§

type Owned = TextString

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

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

fn clone_into(&self, target: &mut Self::Owned)

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

impl ToSocketAddrs for TextStr

§

type Iter = IntoIter<SocketAddr>

Returned iterator over socket addresses which this type may correspond to.
source§

fn to_socket_addrs(&self) -> Result<Self::Iter>

Converts this object to an iterator of resolved SocketAddrs. Read more
source§

impl Eq for TextStr

source§

impl StructuralPartialEq for TextStr

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more