Struct cxx_qt_lib::QHash

source ·
#[repr(C)]
pub struct QHash<T>
where T: QHashPair,
{ /* private fields */ }
Expand description

The QHash class is a template class that provides a hash-table-based dictionary.

Note that this means that T needs to have a C++ global qHash() function.

To use QHash with a custom pair, implement the QHashPair trait for T.

Implementations§

source§

impl QHash<QHashPair_QString_QVariant>

source

pub fn cxx_clear(&mut self)

source§

impl QHash<QHashPair_QString_QVariant>

source

pub fn cxx_contains(&self, key: &QString) -> bool

source§

impl QHash<QHashPair_i32_QByteArray>

source

pub fn cxx_clear(&mut self)

source§

impl QHash<QHashPair_i32_QByteArray>

source

pub fn cxx_contains(&self, key: &i32) -> bool

source§

impl<T> QHash<T>
where T: QHashPair,

source

pub fn clear(&mut self)

Removes all items from the hash.

source

pub fn contains(&self, key: &T::Key) -> bool

Returns true if the hash contains an item with the key; otherwise returns false.

source

pub fn get(&self, key: &T::Key) -> Option<T::Value>

Returns the value associated with the key if it exists.

source

pub fn get_or_default(&self, key: &T::Key) -> T::Value

Returns the value associated with the key or a default value.

source

pub fn insert_clone(&mut self, key: &T::Key, value: &T::Value)

Inserts a new item with the key and a value of value.

The key and value is a reference here so it can be opaque or trivial but note that the key and value is copied when being inserted into the hash.

source

pub fn is_empty(&self) -> bool

Returns true if the hash contains no items; otherwise returns false.

source

pub fn iter(&self) -> Iter<'_, T>

An iterator visiting all key-value pairs in arbitrary order. The iterator element type is (&’a T::Key, &’a T::Value).

source

pub fn len(&self) -> isize

Returns the number of items in the hash.

source

pub fn remove(&mut self, key: &T::Key) -> bool

Removes all the items that have the key from the hash.

Returns true if at least one item was removed, otherwise returns false.

source§

impl<T> QHash<T>
where T: QHashPair, T::Key: ExternType<Kind = Trivial>, T::Value: ExternType<Kind = Trivial>,

source

pub fn insert(&mut self, key: T::Key, value: T::Value)

Inserts a new item with the key and a value of value.

Trait Implementations§

source§

impl<T> Clone for QHash<T>
where T: QHashPair,

source§

fn clone(&self) -> Self

Constructs a copy of other.

1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T> Default for QHash<T>
where T: QHashPair,

source§

fn default() -> Self

Constructs an empty hash.

source§

impl<T> Drop for QHash<T>
where T: QHashPair,

source§

fn drop(&mut self)

Destroys the hash.

source§

impl<T> ExternType for QHash<T>
where T: QHashPair,

§

type Id = <T as QHashPair>::TypeId

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

type Kind = Trivial

source§

impl<T> PartialEq for QHash<T>
where T: QHashPair, T::Value: PartialEq,

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<T> Eq for QHash<T>
where T: QHashPair, T::Value: Eq,

Auto Trait Implementations§

§

impl<T> Freeze for QHash<T>

§

impl<T> RefUnwindSafe for QHash<T>
where T: RefUnwindSafe,

§

impl<T> Send for QHash<T>
where T: Send,

§

impl<T> Sync for QHash<T>
where T: Sync,

§

impl<T> Unpin for QHash<T>
where T: Unpin,

§

impl<T> UnwindSafe for QHash<T>
where T: UnwindSafe,

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