pub struct stack<T: AbiType + 'static> { /* private fields */ }Expand description
cpp class: template<class T, class Container> std::stack<T, Container>
Implementations§
Source§impl<T: AbiType + 'static> stack<T>
 
impl<T: AbiType + 'static> stack<T>
Sourcepub fn pop(&mut self)
 
pub fn pop(&mut self)
如果为空不做任何改变.
use hicc_std::StackInt;
let mut stack = StackInt::new();
stack.pop();
stack.push(&1);
assert_eq!(stack.size(), 1);
stack.pop();
assert_eq!(stack.size(), 0);Sourcepub fn top(&self) -> Option<T::OutputRef<'_>>
 
pub fn top(&self) -> Option<T::OutputRef<'_>>
use hicc_std::StackInt;
let mut stack = StackInt::new();
assert_eq!(stack.top(), None);
stack.push(&1);
assert_eq!(stack.top(), Some(&1));Sourcepub fn top_mut(&mut self) -> Option<T::OutputRefMut<'_>>
 
pub fn top_mut(&mut self) -> Option<T::OutputRefMut<'_>>
use hicc_std::StackInt;
let mut stack = StackInt::new();
assert_eq!(stack.top_mut(), None);
stack.push(&1);
*stack.top_mut().unwrap() += 1;
assert_eq!(stack.top_mut(), Some(&mut 2));
use hicc_std::{string, StackString};
use hicc::AbiClass;
let mut stack = StackString::new();
stack.push(&string::from(c"hello"));
assert_eq!(stack.top(), Some(string::from(c"hello").into_ref()));
stack.top_mut().unwrap().write(string::from(c"world"));
assert_eq!(stack.top(), Some(string::from(c"world").into_ref()));Sourcepub fn is_empty(&self) -> bool
 
pub fn is_empty(&self) -> bool
use hicc_std::StackInt;
let mut stack = StackInt::new();
assert!(stack.is_empty());
stack.push(&1);
assert!(!stack.is_empty());Sourcepub fn size(&self) -> usize
 
pub fn size(&self) -> usize
use hicc_std::StackInt;
let mut stack = StackInt::new();
assert_eq!(stack.size(), 0);
stack.push(&1);
assert_eq!(stack.size(), 1);Sourcepub fn push(&mut self, val: &<T as AbiType>::InputType)
 
pub fn push(&mut self, val: &<T as AbiType>::InputType)
use hicc_std::StackInt;
let mut stack = StackInt::new();
stack.push(&1);
assert_eq!(stack.top(), Some(&1));Sourcepub fn swap(&mut self, other: &mut <stack<T> as AbiType>::InputType)
 
pub fn swap(&mut self, other: &mut <stack<T> as AbiType>::InputType)
use hicc_std::StackInt;
let mut stack = StackInt::new();
stack.push(&1);
let mut other = StackInt::new();
other.push(&2);
assert_eq!(stack.top(), Some(&1));
assert_eq!(other.top(), Some(&2));
stack.swap(&mut other);
assert_eq!(stack.top(), Some(&2));
assert_eq!(other.top(), Some(&1));Trait Implementations§
Source§impl<T: AbiType + 'static> AbiClass for stack<T>
 
impl<T: AbiType + 'static> AbiClass for stack<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 stack<T>
impl<T: AbiType + Sync> Sync for stack<T>
Auto Trait Implementations§
impl<T> Freeze for stack<T>
impl<T> RefUnwindSafe for stack<T>
impl<T> Unpin for stack<T>
impl<T> UnwindSafe for stack<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