Struct priority_queue

Source
#[repr(C)]
pub struct priority_queue<T: AbiType + 'static> { /* private fields */ }
Expand description

对应std::priority_queue<T>

需和include/hicc/std/queue.hpp接口定义保持一致.

Implementations§

Source§

impl<T: AbiType + 'static> priority_queue<T>

Source

pub fn is_empty(&self) -> bool

use hicc_std::PriorityQueueInt;
let mut priority_queue = PriorityQueueInt::new();
assert!(priority_queue.is_empty());
priority_queue.push(&1);
assert!(!priority_queue.is_empty());
Source

pub fn size(&self) -> usize

use hicc_std::PriorityQueueInt;
let mut priority_queue = PriorityQueueInt::new();
assert_eq!(priority_queue.size(), 0);
priority_queue.push(&1);
assert_eq!(priority_queue.size(), 1);
Source

pub fn pop(&mut self)

use hicc_std::PriorityQueueInt;
let mut priority_queue = PriorityQueueInt::new();
priority_queue.push(&1);
assert_eq!(priority_queue.size(), 1);
priority_queue.pop();
assert_eq!(priority_queue.size(), 0);
Source

pub fn push(&mut self, val: <T as AbiType>::InputRef<'_>)

use hicc_std::PriorityQueueInt;
let mut priority_queue = PriorityQueueInt::new();
priority_queue.push(&1);
assert_eq!(priority_queue.top(), &1);
Source

pub fn top<'a>(&'a self) -> <T as AbiType>::OutputRef<'a>

use hicc_std::PriorityQueueInt;
let mut priority_queue = PriorityQueueInt::new();
priority_queue.push(&1);
priority_queue.push(&3);
priority_queue.push(&2);
assert_eq!(priority_queue.top(), &3);
Source

pub fn swap(&mut self, other: <priority_queue<T> as AbiType>::InputRefMut<'_>)

use hicc_std::PriorityQueueInt;
let mut priority_queue = PriorityQueueInt::new();
priority_queue.push(&1);
let mut other = PriorityQueueInt::new();
other.push(&2);
assert_eq!(priority_queue.top(), &1);
assert_eq!(other.top(), &2);
priority_queue.swap(&mut other);
assert_eq!(priority_queue.top(), &2);
assert_eq!(other.top(), &1);

Trait Implementations§

Source§

impl<T: AbiType + 'static> AbiClass for priority_queue<T>

Source§

unsafe fn into_unique(self) -> Self

§unsafety

返回对象析构时会强制释放c++侧的资源, 需要使用者保证正确性

Source§

fn get_raw_obj(&self) -> *const ()

仅内部使用.指针携带附加信息,不能转换为c++类指针.
Source§

unsafe fn make_ref(&self, obj: *const ()) -> Self

Safety Read more
Source§

fn write(&mut self, other: Self)

更新对象本身. Read more
Source§

fn size_of(&self) -> usize

返回c++对象的大小.
Source§

fn is_null(&self) -> bool

rust侧的值类型实际都对应到c++侧的对象指针, 检查是否为空指针.
Source§

fn as_ptr(&self) -> ClassPtr<'_, Self>

Source§

fn as_mut_ptr(&mut self) -> ClassMutPtr<'_, Self>

Source§

fn as_ref(&self) -> ClassRef<'_, Self>

Source§

fn as_mut(&mut self) -> ClassRefMut<'_, Self>

Source§

fn into_ref(self) -> ClassRef<'static, Self>

Source§

fn into_mut(self) -> ClassRefMut<'static, Self>

Source§

fn into_ptr(self) -> ClassPtr<'static, Self>

Source§

fn into_mut_ptr(self) -> ClassMutPtr<'static, Self>

Source§

fn get_obj(&self) -> *const ()

一般内部使用. 返回值等同于c++侧的指针。
Source§

impl<T: AbiType + 'static> Debug for priority_queue<T>

Source§

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

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

impl<T: AbiType + 'static> Drop for priority_queue<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: AbiType + Sync> Send for priority_queue<T>

Source§

impl<T: AbiType + Sync> Sync for priority_queue<T>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AbiType for T
where T: AbiClass,

Source§

type InputType = T

Source§

type InputRef<'a> = &'a T where T: 'a

Source§

type InputRefMut<'a> = &'a mut T where T: 'a

Source§

type InputPtr<'a, P, const N: usize> = &'a ClassPtr<'a, T, N> where T: 'a

Source§

type InputMutPtr<'a, P, const N: usize> = &'a ClassMutPtr<'a, T, N> where T: 'a

Source§

type OutputType = T

Source§

type OutputRef<'a> = ClassRef<'a, T> where T: 'a

Source§

type OutputRefMut<'a> = ClassRefMut<'a, T> where T: 'a

Source§

type OutputPtr<'a, P, const N: usize> = ClassPtr<'a, T, N> where T: 'a

Source§

type OutputMutPtr<'a, P, const N: usize> = ClassMutPtr<'a, T, N> where T: 'a

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