pub struct CapeArrayByteInFromProvider {
interface: ICapeArrayByte,
interface_ptr: *mut ICapeArrayByte,
}Expand description
CapeArrayByteInFromProvider
When calling a CAPE-OPEN method that takes a CapeArrayByte as input,
the caller provides an object that implements CapeArrayByteProviderIn,
for example CapeArrayByteVec.
The CapeArrayByteInFromProvider returns an C::ICapeArrayByte 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::CapePersistWriter.
When implementing a function that gets called, and takes a CapeArrayByte
as input, it received a &CapeArrayByteIn typed argument, which is
constructed from the reference to an C::ICapeArrayByte interface pointer.
Typically a function call receives the C::ICapeArrayByte interface
from the caller, and from this, the CapeArrayByteIn 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
CapeArrayByteProviderIn trait, allocate the pointer, point to it, and
construct the CapeArrayByteIn object from a reference to that pointer.
The CapeArrayByteInFromProvider class does all this.
§Example
use cobia::*;
let array = CapeArrayByteVec::from_slice(&[1,2,3]);
fn ArrayFromCapeArrayByteIn(array:&CapeArrayByteIn) -> Vec<u8> {
array.as_vec()
}
let value=ArrayFromCapeArrayByteIn(&CapeArrayByteInFromProvider::from(&array).as_cape_array_byte_in()); //this is how array is passed as &CapeArrayByteIn argument
assert_eq!(value,vec![1,2,3]);Fields§
§interface: ICapeArrayByte§interface_ptr: *mut ICapeArrayByte