#[repr(C)]pub struct array<T: AbiType + 'static> { /* private fields */ }Expand description
cpp class: template<class T, size_t N> std::array<T, N>
Implementations§
Source§impl<T: AbiType + 'static> array<T>
impl<T: AbiType + 'static> array<T>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
use hicc_std::ArrayInt;
let array = ArrayInt::new_10();
assert!(!array.is_empty());Sourcepub fn get(&self, pos: usize) -> Option<T::OutputRef<'_>>
pub fn get(&self, pos: usize) -> Option<T::OutputRef<'_>>
use hicc_std::ArrayInt;
let mut array = ArrayInt::new_10();
assert_eq!(array.get(0), Some(&0));
assert_eq!(array.get(10), None);Sourcepub fn get_mut(&mut self, pos: usize) -> Option<T::OutputRefMut<'_>>
pub fn get_mut(&mut self, pos: usize) -> Option<T::OutputRefMut<'_>>
use hicc_std::ArrayInt;
let mut array = ArrayInt::new_10();
assert_eq!(array.get_mut(0), Some(&mut 0));
assert_eq!(array.get(10), None);Sourcepub fn back(&self) -> Option<T::OutputRef<'_>>
pub fn back(&self) -> Option<T::OutputRef<'_>>
use hicc_std::ArrayInt;
let array = ArrayInt::new_10();
assert_eq!(array.back(), Some(&0));Sourcepub fn back_mut(&mut self) -> Option<T::OutputRefMut<'_>>
pub fn back_mut(&mut self) -> Option<T::OutputRefMut<'_>>
use hicc_std::ArrayInt;
let mut array = ArrayInt::new_10();
assert!(array.back_mut().is_some());
*array.back_mut().unwrap() += 1;
assert_eq!(array.back_mut(), Some(&mut 1));Sourcepub fn front(&self) -> Option<T::OutputRef<'_>>
pub fn front(&self) -> Option<T::OutputRef<'_>>
use hicc_std::ArrayInt;
let array = ArrayInt::new_10();
assert!(array.front().is_some());Sourcepub fn front_mut(&mut self) -> Option<T::OutputRefMut<'_>>
pub fn front_mut(&mut self) -> Option<T::OutputRefMut<'_>>
use hicc_std::ArrayInt;
let mut array = ArrayInt::new_10();
assert!(array.front().is_some());
*array.front_mut().unwrap() += 1;
assert_eq!(array.front(), Some(&1));Source§impl<T: Sized + 'static> array<Pod<T>>
impl<T: Sized + 'static> array<Pod<T>>
Sourcepub fn as_slice(&self) -> &[T]
pub fn as_slice(&self) -> &[T]
use hicc_std::ArrayInt;
let mut array = ArrayInt::new_10();
array.fill(&1);
array.as_slice().iter().for_each(|v| println!("{v}"));Sourcepub fn as_slice_mut(&mut self) -> &mut [T]
pub fn as_slice_mut(&mut self) -> &mut [T]
use hicc_std::ArrayInt;
let mut array = ArrayInt::new_10();
array.fill(&1);
array.as_slice_mut().iter_mut().for_each(|v| {*v += 1;});Source§impl<T: AbiClass + 'static> array<T>
impl<T: AbiClass + 'static> array<T>
Sourcepub fn as_array(&self) -> ClassArray<'_, T>
pub fn as_array(&self) -> ClassArray<'_, T>
use hicc_std::{ArrayString, string};
let mut array = ArrayString::new_10();
array.fill(&string::from(c"hello"));
array.as_array().iter().for_each(|msg| {
// ...
println!("msg.size() = {}", msg.size());
});Sourcepub fn as_mut_array(&mut self) -> ClassMutArray<'_, T>
pub fn as_mut_array(&mut self) -> ClassMutArray<'_, T>
use hicc_std::{ArrayString, string};
let mut array = ArrayString::new_10();
array.fill(&string::from(c"hello"));
array.as_mut_array().iter_mut().for_each(|mut msg| {
msg.append(1, b'c' as i8);
});Trait Implementations§
Source§impl<T: AbiType + 'static> AbiClass for array<T>
impl<T: AbiType + 'static> AbiClass for array<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 array<T>
impl<T: AbiType + Sync> Sync for array<T>
Auto Trait Implementations§
impl<T> Freeze for array<T>
impl<T> RefUnwindSafe for array<T>
impl<T> Unpin for array<T>
impl<T> UnwindSafe for array<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