Struct CapeArrayBooleanOutFromProvider

Source
pub struct CapeArrayBooleanOutFromProvider {
    interface: ICapeArrayBoolean,
    interface_ptr: *mut ICapeArrayBoolean,
}
Expand description

CapeArrayBooleanOutFromProvider

When calling a CAPE-OPEN method that takes a CapeArrayBoolean as output, the caller provides an object that implements CapeArrayBooleanProviderOut, for example CapeArrayBooleanVec.

The CapeArrayBooleanOutFromProvider returns an C::ICapeArrayBoolean interface, which has a small life span, enough to make sure that the pointer to this interface is valid. This is done inside wrapper classes such as capeopen_1_2::CapeArrayBooleanParameter.

When implementing a function that gets called, and takes a CapeArrayBoolean as output, it received a &mut CapeArrayBooleanOut typed argument, which is constructed from the reference to an C::ICapeArrayBoolean interface pointer.

Typically a function call receives the C::ICapeArrayBoolean interface from the caller, and from this, the CapeArrayBooleanOut is constructed by the cape_object_implementation macro.

In the rare case that one wants to call an internal CAPE-OPEN function directly, one needs to provide the class that implements the CapeArrayBooleanProviderOut trait, allocate the pointer, point to it, and construct the CapeArrayBooleanOut object from a reference to that pointer.

The CapeArrayBooleanOutFromProvider class does all this.

§Example

use cobia::*;
let mut array = CapeArrayBooleanVec::new();
fn SetArrayOut(array:&mut CapeArrayBooleanOut) {
    array.put_array(&[true as cobia::CapeBoolean,false as cobia::CapeBoolean,true as cobia::CapeBoolean]);
}
SetArrayOut(&mut CapeArrayBooleanOutFromProvider::from(&mut array).as_cape_array_boolean_out()); //this is how array is passed as &mut CapeArrayBooleanOut argument
assert_eq!(array.as_vec(),&vec![true as cobia::CapeBoolean,false as cobia::CapeBoolean,true as cobia::CapeBoolean]);

Fields§

§interface: ICapeArrayBoolean§interface_ptr: *mut ICapeArrayBoolean

Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.