Type Alias CapeArrayIntegerSlice

Source
pub type CapeArrayIntegerSlice<'a> = CapeArraySlice<'a, CapeInteger>;
Expand description

Slice based CapeArrayIntegerIn implementation

ICapeArrayInteger is passed as data container between CAPE-OPEN functions. It is up to the caller to provide the interface, and its implementation. This class provides a default impementation using a &[CapeInteger]

§Examples

use cobia::*;

fn test_content(a: &CapeArrayIntegerIn) {
	assert_eq!(a.as_vec(), vec![2,4]);
}
 
let arr = cobia::CapeArrayIntegerSlice::new(&[2,4]);
test_content(&CapeArrayIntegerInFromProvider::from(&arr).as_cape_array_integer_in());

Aliased Type§

pub struct CapeArrayIntegerSlice<'a> {
    slice: &'a [i32],
}

Fields§

§slice: &'a [i32]

Implementations§

Source§

impl<'a> CapeArrayIntegerSlice<'a>

Source

const VTABLE: ICapeArrayInteger_VTable

Interface v-table

Source

extern "C" fn get( me: *mut c_void, data: *mut *mut CapeInteger, size: *mut CapeSize, )

Interface member function

Source

extern "C" fn setsize( _: *mut c_void, _: CapeSize, _: *mut *mut CapeInteger, ) -> CapeResult

Interface member function

Trait Implementations§

Source§

impl<'a> CapeArrayIntegerProviderIn for CapeArrayIntegerSlice<'a>

Source§

fn as_cape_array_integer_in(&self) -> ICapeArrayInteger

Convert to ICapeArrayInteger

Returns a reference to the ICapeArrayInteger interface.

§Examples
use cobia::*;
use cobia::prelude::*;
let arr = cobia::CapeArrayIntegerSlice::new(&[9,10,2]);
let i_cape_array_integer=arr.as_cape_array_integer_in();
let mut i_cape_array_integer_ptr=(&i_cape_array_integer as *const C::ICapeArrayInteger).cast_mut(); //normally a pointer to the interface is received
let a = cobia::CapeArrayIntegerIn::new(&mut i_cape_array_integer_ptr); //CapeArrayIntegerIn from *mut C::ICapeArrayInteger
assert_eq!(a.as_vec(), vec![9,10,2]);