Type Alias CapeArrayEnumerationSlice

Source
pub type CapeArrayEnumerationSlice<'a, Element> = CapeArraySlice<'a, Element>;
Expand description

Slice based CapeArrayEnumerationIn implementation

ICapeArrayEnmeration 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 &[Element].

All CAPE-OPEN and COBIA enumeration types are represented as CapeEnumeration

§Examples

use cobia::*;

fn test_content(a: &CapeArrayEnumerationIn<CapePMCServiceType>) {
	assert_eq!(a.as_vec(), vec![CapePMCServiceType::Inproc64,CapePMCServiceType::COM64]);
}
 
let arr = cobia::CapeArrayEnumerationSlice::new(&[cobia::CapePMCServiceType::Inproc64,cobia::CapePMCServiceType::COM64]);
test_content(&CapeArrayEnumerationInFromProvider::from(&arr).as_cape_array_enumeration_in());

Aliased Type§

pub struct CapeArrayEnumerationSlice<'a, Element> {
    slice: &'a [Element],
}

Fields§

§slice: &'a [Element]

Trait Implementations§

Source§

impl<'a, Element: Copy + Clone> CapeArrayEnumerationProviderIn for CapeArrayEnumerationSlice<'a, Element>

Source§

fn as_cape_array_enumeration_in(&self) -> ICapeArrayEnumeration

Convert to ICapeArrayEnumeration

Returns a reference to the ICapeArrayEnumeration interface.

§Examples
use cobia::*;
use cobia::prelude::*;
let arr = cobia::CapeArrayEnumerationSlice::new(&[cobia::CapePMCServiceType::Inproc64,cobia::CapePMCServiceType::COM64]);
let i_cape_array_enumeration=arr.as_cape_array_enumeration_in();
let mut i_cape_array_enumeration_ptr=(&i_cape_array_enumeration as *const C::ICapeArrayEnumeration).cast_mut(); //normally a pointer to the interface is received
let a = cobia::CapeArrayEnumerationIn::<cobia::CapePMCServiceType>::new(&mut i_cape_array_enumeration_ptr); //CapeArrayEnumerationIn from *mut C::ICapeArrayEnumeration
assert_eq!(a.as_vec(), vec![cobia::CapePMCServiceType::Inproc64,cobia::CapePMCServiceType::COM64]);