pub struct set<T: AbiType + 'static> { /* private fields */ }Expand description
cpp class: template<class T, class Compare, class Allocator> std::set<T, Compare, Allocator>
Implementations§
Source§impl<T: AbiType + 'static> set<T>
impl<T: AbiType + 'static> set<T>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
use hicc_std::SetInt;
let set = SetInt::new();
assert!(set.is_empty());Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
use hicc_std::SetInt;
let set = SetInt::new();
assert_eq!(set.size(), 0_usize);Sourcepub fn max_size(&self) -> usize
pub fn max_size(&self) -> usize
use hicc_std::SetInt;
let set = SetInt::new();
println!("set.max_size = {}", set.max_size());Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
set.clear();
assert!(set.is_empty());Sourcepub fn swap(&mut self, other: &mut <set<T> as AbiType>::InputType)
pub fn swap(&mut self, other: &mut <set<T> as AbiType>::InputType)
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
set.swap(&mut SetInt::new());
assert!(set.is_empty());Sourcepub fn count(&self, val: &<T as AbiType>::InputType) -> usize
pub fn count(&self, val: &<T as AbiType>::InputType) -> usize
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
assert_eq!(set.count(&1), 1);Sourcepub fn contains(&self, val: &<T as AbiType>::InputType) -> bool
pub fn contains(&self, val: &<T as AbiType>::InputType) -> bool
cpp global function: bool SelfMethods::contains(const Self&, const T&)
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
assert!(set.contains(&1));Sourcepub fn assign(&mut self, other: &<set<T> as AbiType>::InputType)
pub fn assign(&mut self, other: &<set<T> as AbiType>::InputType)
cpp global function: void hicc::make_assign<Self, Self>(Self&, const Self&)
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
set.assign(&SetInt::new());
assert!(set.is_empty());Source§impl<T: AbiType> set<T>
impl<T: AbiType> set<T>
Sourcepub fn iter(&self) -> impl Iterator<Item = T::OutputRef<'_>>
pub fn iter(&self) -> impl Iterator<Item = T::OutputRef<'_>>
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
set.insert(&2);
set.iter().for_each(|v| println!("value = {v}"));Sourcepub fn rev_iter(&self) -> impl Iterator<Item = T::OutputRef<'_>>
pub fn rev_iter(&self) -> impl Iterator<Item = T::OutputRef<'_>>
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
set.insert(&2);
set.rev_iter().for_each(|v| println!("value = {v}"));Sourcepub fn iter_lower_upper_bound(
&self,
lower_key: Option<&T::InputType>,
upper_key: Option<&T::InputType>,
) -> impl Iterator<Item = T::OutputRef<'_>>
pub fn iter_lower_upper_bound( &self, lower_key: Option<&T::InputType>, upper_key: Option<&T::InputType>, ) -> impl Iterator<Item = T::OutputRef<'_>>
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
set.insert(&2);
set.insert(&3);
let mut it = set.iter_lower_upper_bound(Some(&1), Some(&2));
assert_eq!(it.next(), Some(&1));
assert_eq!(it.next(), Some(&2));
assert_eq!(it.next(), None);Sourcepub fn rev_iter_lower_upper_bound(
&self,
lower_key: Option<&T::InputType>,
upper_key: Option<&T::InputType>,
) -> impl Iterator<Item = T::OutputRef<'_>>
pub fn rev_iter_lower_upper_bound( &self, lower_key: Option<&T::InputType>, upper_key: Option<&T::InputType>, ) -> impl Iterator<Item = T::OutputRef<'_>>
use hicc_std::SetInt;
let mut set = SetInt::new();
set.insert(&1);
set.insert(&2);
set.insert(&3);
let mut it = set.rev_iter_lower_upper_bound(Some(&1), Some(&2));
assert_eq!(it.next(), Some(&2));
assert_eq!(it.next(), Some(&1));
assert_eq!(it.next(), None);Trait Implementations§
Source§impl<T: AbiType + 'static> AbiClass for set<T>
impl<T: AbiType + 'static> AbiClass for set<T>
Source§fn get_raw_obj(&self) -> *const ()
fn get_raw_obj(&self) -> *const ()
仅内部使用.指针携带附加信息,不能转换为
c++类指针.Source§unsafe fn into_unique(self) -> Self
unsafe fn into_unique(self) -> Self
Safety Read more
Source§fn as_mut(&mut self) -> ClassRefMut<'_, Self>
fn as_mut(&mut self) -> ClassRefMut<'_, Self>
Source§fn as_mut_ptr(&mut self) -> ClassMutPtr<'_, Self>
fn as_mut_ptr(&mut self) -> ClassMutPtr<'_, Self>
AbiType::InputMutPtr<'_, T>参数类型实际是&ClassMutPtr<'_, T>,
当需要传递这类参数时可调用此接口.Source§fn into_ref(self) -> ClassRef<'static, Self>
fn into_ref(self) -> ClassRef<'static, Self>
T, ClassRef<'_, T>, ClassRefMut<'_, T>, ClassPtr<'_, T>, ClassMutPtr<'_, T>作为返回值实质是等价.Source§fn into_mut(self) -> ClassRefMut<'static, Self>
fn into_mut(self) -> ClassRefMut<'static, Self>
T, ClassRef<'_, T>, ClassRefMut<'_, T>, ClassPtr<'_, T>, ClassMutPtr<'_, T>作为返回值实质是等价.Source§fn into_ptr(self) -> ClassPtr<'static, Self>
fn into_ptr(self) -> ClassPtr<'static, Self>
T, ClassRef<'_, T>, ClassRefMut<'_, T>, ClassPtr<'_, T>, ClassMutPtr<'_, T>作为返回值实质是等价.Source§fn into_mut_ptr(self) -> ClassMutPtr<'static, Self>
fn into_mut_ptr(self) -> ClassMutPtr<'static, Self>
T, ClassRef<'_, T>, ClassRefMut<'_, T>, ClassPtr<'_, T>, ClassMutPtr<'_, T>作为返回值实质是等价.impl<T: AbiType + Sync> Send for set<T>
impl<T: AbiType + Sync> Sync for set<T>
Auto Trait Implementations§
impl<T> Freeze for set<T>
impl<T> RefUnwindSafe for set<T>
impl<T> Unpin for set<T>
impl<T> UnwindSafe for set<T>
Blanket Implementations§
Source§impl<T> AbiType for Twhere
T: AbiClass,
impl<T> AbiType for Twhere
T: AbiClass,
type InputType = T
type InputPtr<'a, P, const N: usize> = &'a ClassPtr<'a, T, N> where T: 'a
type InputMutPtr<'a, P, const N: usize> = &'a ClassMutPtr<'a, T, N> where T: 'a
type OutputType = T
type OutputRef<'a> = ClassRef<'a, T> where T: 'a
type OutputRefMut<'a> = ClassRefMut<'a, T> where T: 'a
type OutputPtr<'a, P, const N: usize> = ClassPtr<'a, T, N> where T: 'a
type OutputMutPtr<'a, P, const N: usize> = ClassMutPtr<'a, T, N> where T: 'a
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more