Type Alias CapeArrayBooleanOut

Source
pub type CapeArrayBooleanOut<'a> = CapeArrayOut<'a, CapeBoolean, ICapeArrayBoolean>;
Expand description

CapeArrayBooleanOut wraps an ICapeArrayBoolean interface pointer.

Given an ICapeArrayBoolean interface pointer, this allows setting and getting the elements.

This interface is typically used as arguments to rust methods on traits that are generated from CAPE-OPEN interfaces that have ICapeArrayBoolean output arguments.

§Examples

use cobia::*;

fn set_content(a: &mut CapeArrayBooleanOut) {
	a.put_array(&[false as CapeBoolean,true as CapeBoolean,true as CapeBoolean,false as CapeBoolean]).unwrap();
}
 
let mut arr = cobia::CapeArrayBooleanVec::new();
set_content(&mut CapeArrayBooleanOutFromProvider::from(&mut arr).as_cape_array_boolean_out());
assert_eq!(arr.as_vec(), &vec![false as CapeBoolean,true as CapeBoolean,true as CapeBoolean,false as CapeBoolean]);

Aliased Type§

pub struct CapeArrayBooleanOut<'a> {
    pub(crate) interface: &'a mut *mut ICapeArrayBoolean,
    data: *mut u32,
    size: u32,
}

Fields§

§interface: &'a mut *mut ICapeArrayBoolean§data: *mut u32§size: u32

Implementations§

Source§

impl<'a> CapeArrayBooleanOut<'a>

Source

pub fn as_bool_vec(&self) -> Vec<bool>

Returns the elements of the array as a Vec<bool>.

§Examples
use cobia::*;

fn test_content(a: CapeArrayBooleanOut) {
    assert_eq!(a.as_bool_vec(), vec![false,true,true,false]);
}
 
let mut arr = cobia::CapeArrayBooleanVec::from_bool_slice(&[false,true,true,false]);
test_content(CapeArrayBooleanOutFromProvider::from(&mut arr).as_cape_array_boolean_out())
Source

pub fn set<T: CapeArrayBooleanProviderIn>( &mut self, array: &T, ) -> Result<(), COBIAError>

Set the content of the boolean array from any object that implements CapeArrayBooleanProviderIn.

§Arguments
  • array - An object that implements CapeArrayBooleanProviderIn
§Examples
use cobia::*;
fn set_content(a: &mut CapeArrayBooleanOut, b: &CapeArrayBooleanIn) {
	a.put_array(&[false as CapeBoolean,true as CapeBoolean,true as CapeBoolean,false as CapeBoolean]).unwrap();
}
 
let mut arr = cobia::CapeArrayBooleanVec::new();
let arr1 = cobia::CapeArrayBooleanVec::from_bool_slice(&[false,true,true,false]);
set_content(&mut CapeArrayBooleanOutFromProvider::from(&mut arr).as_cape_array_boolean_out(),&CapeArrayBooleanInFromProvider::from(&arr1).as_cape_array_boolean_in());
assert_eq!(arr.as_vec(), &[false as CapeBoolean,true as CapeBoolean,true as CapeBoolean,false as CapeBoolean]);

Trait Implementations§