Type Alias CapeArrayEnumerationVec

Source
pub type CapeArrayEnumerationVec<Element> = CapeArrayVec<Element, ICapeArrayEnumeration>;
Expand description

Vector based CapeArrayEnumerationOut 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 Vec<Element>.

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

§Examples

use cobia::*;

fn resize(a: &mut CapeArrayEnumerationOut<cobia::CapePMCServiceType>) {
   a.resize(4).unwrap();
}
 
let mut arr = cobia::CapeArrayEnumerationVec::<cobia::CapePMCServiceType>::from_slice(&[cobia::CapePMCServiceType::Inproc64,cobia::CapePMCServiceType::COM64]);
resize(&mut CapeArrayEnumerationOutFromProvider::from(&mut arr).as_cape_array_enumeration_out());
assert_eq!(arr.size(), 4); 

Aliased Type§

pub struct CapeArrayEnumerationVec<Element> {
    vec: Vec<Element>,
    interface_type: PhantomData<ICapeArrayEnumeration>,
}

Fields§

§vec: Vec<Element>§interface_type: PhantomData<ICapeArrayEnumeration>

Implementations§

Source§

impl<Element: Copy + Clone> CapeArrayEnumerationVec<Element>

Source

pub fn resize(&mut self, size: usize, value: Element)

Resize

Resize the array to the given size. If the size is larger than the current size, the new elements are set specified value.

§Arguments
  • size - The new size of the array
  • value - The value to set the new elements to
§Examples
use cobia;
use cobia::prelude::*;
let mut arr = cobia::CapeArrayEnumerationVec::from_slice(&[cobia::CapePMCServiceType::Inproc64,cobia::CapePMCServiceType::COM64]);
arr.resize(4,cobia::CapePMCServiceType::Inproc32);
assert_eq!(arr.as_vec(), &vec![cobia::CapePMCServiceType::Inproc64,cobia::CapePMCServiceType::COM64,cobia::CapePMCServiceType::Inproc32,cobia::CapePMCServiceType::Inproc32]);

Trait Implementations§

Source§

impl<Element: Copy + Clone> CapeArrayEnumerationProviderIn for CapeArrayEnumerationVec<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::CapeArrayEnumerationVec::from_slice(&[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]);
Source§

impl<Element: Copy + Clone> CapeArrayEnumerationProviderOut for CapeArrayEnumerationVec<Element>

Source§

fn as_cape_array_enumeration_out(&mut self) -> ICapeArrayEnumeration

Convert to ICapeArrayEnumeration

Returns a mutable reference to the ICapeArrayEnumeration interface.

§Examples
use cobia::*;
use cobia::prelude::*;
let mut arr = cobia::CapeArrayEnumerationVec::from_slice(&[cobia::CapePMCServiceType::Inproc64,cobia::CapePMCServiceType::COM64]);
let i_cape_array_enumeration=arr.as_cape_array_enumeration_out();
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::CapeArrayEnumerationOut::<cobia::CapePMCServiceType>::new(&mut i_cape_array_enumeration_ptr); //CapeArrayEnumerationOut from *mut C::ICapeArrayEnumeration
assert_eq!(a.as_vec(), vec![cobia::CapePMCServiceType::Inproc64,cobia::CapePMCServiceType::COM64]);