Type Alias CapeArrayByteSlice

Source
pub type CapeArrayByteSlice<'a> = CapeArraySlice<'a, CapeByte>;
Expand description

Slice based CapeArrayByteIn implementation

ICapeArrayByte 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 &[CapeByte].

§Examples

use cobia::*;

fn test_content(a: &CapeArrayByteIn) {
	assert_eq!(a.as_vec(), vec![2u8,4u8]);
}
 
let arr = cobia::CapeArrayByteSlice::new(&[2u8,4u8]);
test_content(&CapeArrayByteInFromProvider::from(&arr).as_cape_array_byte_in());

Aliased Type§

pub struct CapeArrayByteSlice<'a> {
    slice: &'a [u8],
}

Fields§

§slice: &'a [u8]

Implementations§

Source§

impl<'a> CapeArrayByteSlice<'a>

Source

const VTABLE: ICapeArrayByte_VTable

Interface v-table

Source

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

Interface member function

Source

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

Interface member function

Trait Implementations§

Source§

impl<'a> CapeArrayByteProviderIn for CapeArrayByteSlice<'a>

Source§

fn as_cape_array_byte_in(&self) -> ICapeArrayByte

Convert to ICapeArrayByte

Returns a reference to the ICapeArrayByte interface.

§Examples
use cobia::*;
use cobia::prelude::*;
let arr = cobia::CapeArrayByteSlice::new(&[9u8,10u8,2u8]);
let i_cape_array_byte=arr.as_cape_array_byte_in();
let mut i_cape_array_byte_ptr=(&i_cape_array_byte as *const C::ICapeArrayByte).cast_mut(); //normally a pointer to the interface is received
let a = cobia::CapeArrayByteIn::new(&mut i_cape_array_byte_ptr); //CapeArrayByteIn from *mut C::ICapeArrayByte
assert_eq!(a.as_vec(), vec![9u8,10u8,2u8]);