XString

Struct XString 

Source
pub struct XString<S: Str + ?Sized = str, A: Allocator = Global> { /* private fields */ }

Implementations§

Source§

impl<S: Str + ?Sized> XString<S>

Source

pub fn new(source: &S) -> Self

Source

pub fn from_static(source: &'static S) -> Self

Source§

impl<S: Str + ?Sized, A: Allocator> XString<S, A>

Source

pub fn new_in(source: &S, allocator: A) -> Self

Source

pub unsafe fn slice_as(&self, dst: &S) -> Self

§Safety

It is the caller’s responsibility to ensure that the dst is derived from self

Source

pub fn slice<T>(&self, idx: T) -> Self
where S: Index<T, Output = S>,

Source§

impl<A: Allocator> XString<str, A>

Source

pub fn as_str(&self) -> &str

Source§

impl<A: Allocator> XString<CStr, A>

Source

pub fn as_c_str(&self) -> &CStr

Source§

impl<A: Allocator> XString<[u8], A>

Source

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

Trait Implementations§

Source§

impl<A: Allocator> AsRef<[u8]> for XString<CStr, A>

Source§

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

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

impl<A: Allocator> AsRef<[u8]> for XString<OsStr, A>

Source§

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

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

impl<A: Allocator> AsRef<[u8]> for XString<Path, A>

Source§

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

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

impl<A: Allocator> AsRef<[u8]> for XString<str, A>

Source§

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

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

impl<A: Allocator> AsRef<OsStr> for XString<Path, A>

Source§

fn as_ref(&self) -> &OsStr

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

impl<A: Allocator> AsRef<OsStr> for XString<str, A>

Source§

fn as_ref(&self) -> &OsStr

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

impl<A: Allocator> AsRef<Path> for XString<OsStr, A>

Source§

fn as_ref(&self) -> &Path

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

impl<A: Allocator> AsRef<Path> for XString<str, A>

Source§

fn as_ref(&self) -> &Path

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

impl<S: Str + ?Sized, A: Allocator> AsRef<S> for XString<S, A>

Source§

fn as_ref(&self) -> &S

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

impl<S: Str + ?Sized, A: Allocator> Borrow<S> for XString<S, A>

Source§

fn borrow(&self) -> &S

Immutably borrows from an owned value. Read more
Source§

impl<S: Str + ?Sized, A: Allocator> Clone for XString<S, A>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<S: Str + ?Sized + Debug, A: Allocator> Debug for XString<S, A>

Source§

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

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

impl<S: Str + ?Sized, A: Allocator> Deref for XString<S, A>

Source§

type Target = S

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'de, T: Str + ?Sized, A: Allocator + Default> Deserialize<'de> for XString<T, A>
where &'de T: Deserialize<'de> + 'de,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<S: Str + ?Sized + Display, A: Allocator> Display for XString<S, A>

Source§

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

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

impl<S: Str + ?Sized, A: Allocator> Drop for XString<S, A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<S: Str + ?Sized> From<&S> for XString<S>

Source§

fn from(value: &S) -> Self

Converts to this type from the input type.
Source§

impl<S: Str + ?Sized> From<&mut S> for XString<S>

Source§

fn from(value: &mut S) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<CStr>> for XString<CStr>

Source§

fn from(value: Arc<CStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<OsStr>> for XString<OsStr>

Source§

fn from(value: Arc<OsStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<Path>> for XString<Path>

Source§

fn from(value: Arc<Path>) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<str>> for XString<str>

Source§

fn from(value: Arc<str>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<CStr>> for XString<CStr>

Source§

fn from(value: Box<CStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<OsStr>> for XString<OsStr>

Source§

fn from(value: Box<OsStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<Path>> for XString<Path>

Source§

fn from(value: Box<Path>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<str>> for XString<str>

Source§

fn from(value: Box<str>) -> Self

Converts to this type from the input type.
Source§

impl From<CString> for XString<CStr>

Source§

fn from(value: CString) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, CStr>> for XString<CStr>

Source§

fn from(value: Cow<'_, CStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, OsStr>> for XString<OsStr>

Source§

fn from(value: Cow<'_, OsStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, Path>> for XString<Path>

Source§

fn from(value: Cow<'_, Path>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, str>> for XString<str>

Source§

fn from(value: Cow<'_, str>) -> Self

Converts to this type from the input type.
Source§

impl From<OsString> for XString<OsStr>

Source§

fn from(value: OsString) -> Self

Converts to this type from the input type.
Source§

impl From<PathBuf> for XString<Path>

Source§

fn from(value: PathBuf) -> Self

Converts to this type from the input type.
Source§

impl From<String> for XString<str>

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl FromStr for XString

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<S: Str + ?Sized + Hash, A: Allocator> Hash for XString<S, 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<S: Str + ?Sized + Ord, A: Allocator> Ord for XString<S, A>

Source§

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

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

impl<S: Str + ?Sized + PartialEq, A: Allocator> PartialEq<&S> for XString<S, A>

Source§

fn eq(&self, other: &&S) -> 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<S: Str + ?Sized + PartialEq, A: Allocator> PartialEq<Arc<S>> for XString<S, A>

Source§

fn eq(&self, other: &Arc<S>) -> 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<S: Str + ?Sized + PartialEq, A: Allocator> PartialEq<Box<S>> for XString<S, A>

Source§

fn eq(&self, other: &Box<S>) -> 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<S: Str + ?Sized + PartialEq, A: Allocator> PartialEq<Rc<S>> for XString<S, A>

Source§

fn eq(&self, other: &Rc<S>) -> 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<S: Str + ?Sized + PartialEq, A: Allocator> PartialEq<S> for XString<S, A>

Source§

fn eq(&self, other: &S) -> 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<S: Str + ?Sized + PartialEq, A: Allocator> PartialEq for XString<S, A>

Source§

fn eq(&self, other: &Self) -> 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<S: Str + ?Sized + PartialOrd, A: Allocator> PartialOrd<&S> for XString<S, A>

Source§

fn partial_cmp(&self, other: &&S) -> 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<S: Str + ?Sized + PartialOrd, A: Allocator> PartialOrd<Arc<S>> for XString<S, A>

Source§

fn partial_cmp(&self, other: &Arc<S>) -> 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<S: Str + ?Sized + PartialOrd, A: Allocator> PartialOrd<Box<S>> for XString<S, A>

Source§

fn partial_cmp(&self, other: &Box<S>) -> 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<S: Str + ?Sized + PartialOrd, A: Allocator> PartialOrd<Rc<S>> for XString<S, A>

Source§

fn partial_cmp(&self, other: &Rc<S>) -> 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<S: Str + ?Sized + PartialOrd, A: Allocator> PartialOrd<S> for XString<S, A>

Source§

fn partial_cmp(&self, other: &S) -> 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<S: Str + ?Sized + PartialOrd, A: Allocator> PartialOrd for XString<S, A>

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

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<T: Str + ?Sized + Serialize, A: Allocator> Serialize for XString<T, A>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<S: Str + ?Sized + ToSocketAddrs, A: Allocator> ToSocketAddrs for XString<S, A>

Source§

type Iter = <S as ToSocketAddrs>::Iter

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<S: Str + ?Sized + Eq, A: Allocator> Eq for XString<S, A>

Source§

impl<S: Str + ?Sized + Send, A: Allocator> Send for XString<S, A>

Source§

impl<S: Str + ?Sized + Sync, A: Allocator> Sync for XString<S, A>

Source§

impl<S: Str + ?Sized + Unpin, A: Allocator> Unpin for XString<S, A>

Auto Trait Implementations§

§

impl<S, A> Freeze for XString<S, A>
where S: ?Sized,

§

impl<S = str, A = Global> !RefUnwindSafe for XString<S, A>

§

impl<S = str, A = Global> !UnwindSafe for XString<S, 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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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§

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>,

Source§

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>,

Source§

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,