Struct QString

Source
#[repr(C)]
pub struct QString { /* private fields */ }
Expand description

The QString class provides a Unicode character string.

Note that QString is a UTF-16 whereas Rust strings are a UTF-8

Implementations§

Source§

impl<'a> QString

Source

pub fn append(&'a mut self, str: &QString) -> &'a mut QString

Appends the string str onto the end of this string.

Source§

impl QString

Source

pub fn clear(&mut self)

Clears the contents of the string and makes it null.

Source§

impl QString

Source

pub fn contains(&self, str: &QString, cs: CaseSensitivity) -> bool

Returns true if this string contains an occurrence of the string str; otherwise returns false.

Source§

impl QString

Source

pub fn ends_with(&self, s: &QString, cs: CaseSensitivity) -> bool

Returns true if the string ends with s; otherwise returns false.

Source§

impl QString

Source

pub fn is_empty(&self) -> bool

Returns true if the string has no characters; otherwise returns false.

Source§

impl QString

Source

pub fn is_lower(&self) -> bool

Returns true if the string is lowercase, that is, it’s identical to its toLower() folding.

Source§

impl QString

Source

pub fn is_null(&self) -> bool

Returns true if this string is null; otherwise returns false.

Source§

impl QString

Source

pub fn is_right_to_left(&self) -> bool

Returns true if the string is read right to left.

Source§

impl QString

Source

pub fn is_upper(&self) -> bool

Returns true if the string is uppercase, that is, it’s identical to its toUpper() folding.

Source§

impl QString

Source

pub fn is_valid_utf16(&self) -> bool

Returns true if the string contains valid UTF-16 encoded data, or false otherwise.

Source§

impl<'a> QString

Source

pub fn prepend(&'a mut self, str: &QString) -> &'a mut QString

Prepends the string str to the beginning of this string and returns a reference to this string.

Source§

impl<'a> QString

Source

pub fn remove( &'a mut self, str: &QString, cs: CaseSensitivity, ) -> &'a mut QString

Removes every occurrence of the given str string in this string, and returns a reference to this string.

Source§

impl<'a> QString

Source

pub fn replace( &'a mut self, before: &QString, after: &QString, cs: CaseSensitivity, ) -> &'a mut QString

Replaces every occurrence of the string before with the string after and returns a reference to this string.

Source§

impl QString

Source

pub fn starts_with(&self, s: &QString, cs: CaseSensitivity) -> bool

Returns true if the string starts with s; otherwise returns false.

Source§

impl QString

Source

pub fn to_html_escaped(&self) -> QString

Converts a plain text string to an HTML string with HTML metacharacters <, >, &, and “ replaced by HTML entities.

Source§

impl QString

Source

pub fn arg(&self, a: &QString) -> Self

Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, …, %99.

Source

pub fn compare(&self, other: &QString, cs: CaseSensitivity) -> Ordering

Lexically compares this string with the other string and returns if this string is less than, equal to, or greater than the other string.

Source

pub fn index_of(&self, str: &QString, from: isize, cs: CaseSensitivity) -> isize

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

Source

pub fn insert<'a>(&'a mut self, pos: isize, str: &Self) -> &'a mut Self

Inserts the string str at the given index position and returns a mutable reference to this string.

Source

pub fn left(&self, n: isize) -> Self

Returns a substring that contains the n leftmost characters of the string.

Source

pub fn len(self: &QString) -> isize

Returns the number of characters in this string.

Source

pub fn mid(&self, position: isize, n: isize) -> Self

Returns a string that contains n characters of this string, starting at the specified position index.

Source

pub fn right(&self, n: isize) -> Self

Returns a substring that contains the n rightmost characters of the string.

Source

pub fn simplified(&self) -> Self

Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.

Source

pub fn split( &self, sep: &QString, behavior: SplitBehaviorFlags, cs: CaseSensitivity, ) -> QStringList

Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.

Source

pub fn to_latin1(&self) -> QByteArray

Returns a Latin-1 representation of the string as a QByteArray.

Source

pub fn to_local8bit(&self) -> QByteArray

Returns the local 8-bit representation of the string as a QByteArray. The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.

Source

pub fn to_lower(&self) -> Self

Returns a lowercase copy of the string.

Source

pub fn to_upper(&self) -> Self

Returns an uppercase copy of the string.

Source

pub fn to_utf8(&self) -> QByteArray

Returns a UTF-8 representation of the string as a QByteArray.

Source

pub fn trimmed(&self) -> Self

Returns a string that has whitespace removed from the start and the end.

Trait Implementations§

Source§

impl Add for QString

Source§

type Output = QString

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl Clone for QString

Source§

fn clone(&self) -> Self

Constructs a copy of other.

This operation takes constant time, because QString is implicitly shared. This makes returning a QString from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.

1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for QString

Source§

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

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

impl Default for QString

Source§

fn default() -> Self

Constructs a null string. Null strings are also empty.

Source§

impl Display for QString

Source§

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

Convert the QString to a Rust string

Note that this converts from UTF-16 to UTF-8

Source§

impl Drop for QString

Source§

fn drop(&mut self)

Destroys the string.

Source§

impl ExternType for QString

Source§

type Id = (Q, S, t, r, i, n, g)

A type-level representation of the type’s C++ namespace and type name. Read more
Source§

type Kind = Trivial

Source§

impl<'a> From<&'a QString> for QAnyStringView<'a>

Source§

fn from(string: &'a QString) -> Self

Constructs a QAnyStringView from a QString

Source§

impl From<&QString> for QStringList

Source§

fn from(string: &QString) -> Self

Constructs a string list that contains the given string

Source§

impl From<&QString> for QUrl

Source§

fn from(str: &QString) -> Self

Constructs a QUrl from a QString

Source§

impl From<&QString> for String

Source§

fn from(qstring: &QString) -> Self

Convert the QString to a Rust string

Note that this converts from UTF-16 to UTF-8

Source§

impl From<&String> for QString

Source§

fn from(str: &String) -> Self

Constructs a QString from a Rust string

Note that this converts from UTF-8 to UTF-16

Source§

impl From<&str> for QString

Source§

fn from(str: &str) -> Self

Constructs a QString from a Rust string

Note that this converts from UTF-8 to UTF-16

Source§

impl From<QString> for String

Source§

fn from(qstring: QString) -> Self

Convert the QString to a Rust string

Note that this converts from UTF-16 to UTF-8

Source§

impl From<String> for QString

Source§

fn from(str: String) -> Self

Constructs a QString from a Rust string

Note that this converts from UTF-8 to UTF-16

Source§

impl Ord for QString

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 PartialEq for QString

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 PartialOrd for QString

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 QListElement for QString

Source§

type TypeId = (Q, L, i, s, t, __, Q, S, t, r, i, n, g)

Source§

fn append(list: &mut QList<Self>, value: Self)

Source§

fn append_clone(list: &mut QList<Self>, value: &Self)

Source§

fn clear(list: &mut QList<Self>)

Source§

fn clone(list: &QList<Self>) -> QList<Self>

Source§

fn contains(list: &QList<Self>, value: &Self) -> bool

Source§

fn default() -> QList<Self>

Source§

fn drop(list: &mut QList<Self>)

Source§

unsafe fn get_unchecked(list: &QList<Self>, pos: isize) -> &Self

Safety Read more
Source§

fn index_of(list: &QList<Self>, value: &Self) -> isize

Source§

fn insert(list: &mut QList<Self>, pos: isize, value: Self)

Source§

fn insert_clone(list: &mut QList<Self>, pos: isize, value: &Self)

Source§

fn len(list: &QList<Self>) -> isize

Source§

fn remove(list: &mut QList<Self>, pos: isize)

Source§

fn reserve(list: &mut QList<Self>, size: isize)

Source§

impl QSetElement for QString

Source§

type TypeId = (Q, S, e, t, __, Q, S, t, r, i, n, g)

Source§

fn clear(set: &mut QSet<Self>)

Source§

fn clone(set: &QSet<Self>) -> QSet<Self>

Source§

fn contains(set: &QSet<Self>, value: &Self) -> bool

Source§

fn default() -> QSet<Self>

Source§

fn drop(set: &mut QSet<Self>)

Source§

unsafe fn get_unchecked(set: &QSet<Self>, pos: isize) -> &Self

Safety Read more
Source§

fn insert(set: &mut QSet<Self>, value: Self)

Source§

fn insert_clone(set: &mut QSet<Self>, value: &Self)

Source§

fn len(set: &QSet<Self>) -> isize

Source§

fn remove(set: &mut QSet<Self>, value: &Self) -> bool

Source§

impl QVariantValue for QString

Source§

fn can_convert(variant: &QVariant) -> bool

Source§

fn construct(value: &Self) -> QVariant

Source§

fn value_or_default(variant: &QVariant) -> Self

Source§

impl QVectorElement for QString

Source§

type TypeId = (Q, V, e, c, t, o, r, __, Q, S, t, r, i, n, g)

Source§

fn append(vector: &mut QVector<Self>, value: Self)

Source§

fn append_clone(vector: &mut QVector<Self>, value: &Self)

Source§

fn clear(vector: &mut QVector<Self>)

Source§

fn clone(vector: &QVector<Self>) -> QVector<Self>

Source§

fn contains(vector: &QVector<Self>, value: &Self) -> bool

Source§

fn default() -> QVector<Self>

Source§

fn drop(vector: &mut QVector<Self>)

Source§

unsafe fn get_unchecked(vector: &QVector<Self>, pos: isize) -> &Self

Safety Read more
Source§

fn index_of(vector: &QVector<Self>, value: &Self) -> isize

Source§

fn insert(vector: &mut QVector<Self>, pos: isize, value: Self)

Source§

fn insert_clone(vector: &mut QVector<Self>, pos: isize, value: &Self)

Source§

fn len(vector: &QVector<Self>) -> isize

Source§

fn remove(vector: &mut QVector<Self>, pos: isize)

Source§

fn reserve(vector: &mut QVector<Self>, size: isize)

Source§

impl Eq for QString

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