Struct cxx_qt_lib::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<'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 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

§

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

§

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

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

type Kind = Trivial

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

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

impl PartialEq for QString

source§

fn eq(&self, other: &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 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

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

§

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

§

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§

impl QVectorElement for QString

§

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 TryFrom<&QString> for QColor

§

type Error = &'static str

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

fn try_from(value: &QString) -> Result<Self, Self::Error>

Performs the conversion.
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> 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.