pub struct CapeArraySlice<'a, Element: Copy + Clone> {
slice: &'a [Element],
}Expand description
Slice based implementation of ICapeArray
Base class for several slice based ICapeArray implementations.
Any ICapeArray (e.g. ICapeArrayReal) 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, that uses a reference to the slice its data
These data types can only be used as input argument, not as output argument, as the reference to the slice is non mutable.
§Examples
use cobia::*;
fn test_content(a: &CapeArrayRealIn) {
assert_eq!(a.as_slice(), &[2.5,4.5]);
}
let arr = cobia::CapeArrayRealSlice::new(&[2.5,4.5]);
test_content(&CapeArrayRealInFromProvider::from(&arr).as_cape_array_real_in());Fields§
§slice: &'a [Element]Implementations§
Source§impl<'a, Element: Copy + Clone> CapeArraySlice<'a, Element>
impl<'a, Element: Copy + Clone> CapeArraySlice<'a, Element>
Sourcepub fn new(slice: &'a [Element]) -> Self
pub fn new(slice: &'a [Element]) -> Self
New from slice
Creates a new CapeArraySlice from a slice.
§Arguments
slice- A vector or slice or slice of values to be used as CapeArraySlice - values are referenced
§Examples
use cobia;
use cobia::prelude::*;
let arr = cobia::CapeArrayRealSlice::new(&[2.5,4.5]);
assert_eq!(arr.as_slice(), &vec![2.5,4.5]);Source§impl<'a> CapeArraySlice<'a, f64>
impl<'a> CapeArraySlice<'a, f64>
Source§impl<'a> CapeArraySlice<'a, i32>
impl<'a> CapeArraySlice<'a, i32>
Sourceconst VTABLE: ICapeArrayInteger_VTable
const VTABLE: ICapeArrayInteger_VTable
Interface v-table
Sourceextern "C" fn get(
me: *mut c_void,
data: *mut *mut CapeInteger,
size: *mut CapeSize,
)
extern "C" fn get( me: *mut c_void, data: *mut *mut CapeInteger, size: *mut CapeSize, )
Interface member function
Sourceextern "C" fn setsize(
_: *mut c_void,
_: CapeSize,
_: *mut *mut CapeInteger,
) -> CapeResult
extern "C" fn setsize( _: *mut c_void, _: CapeSize, _: *mut *mut CapeInteger, ) -> CapeResult
Interface member function
Source§impl<'a> CapeArraySlice<'a, u8>
impl<'a> CapeArraySlice<'a, u8>
Source§impl<'a> CapeArraySlice<'a, u32>
impl<'a> CapeArraySlice<'a, u32>
Sourceconst VTABLE: ICapeArrayBoolean_VTable
const VTABLE: ICapeArrayBoolean_VTable
Interface v-table
Sourceextern "C" fn get(
me: *mut c_void,
data: *mut *mut CapeBoolean,
size: *mut CapeSize,
)
extern "C" fn get( me: *mut c_void, data: *mut *mut CapeBoolean, size: *mut CapeSize, )
Interface member function
Sourceextern "C" fn setsize(
_: *mut c_void,
_: CapeSize,
_: *mut *mut CapeBoolean,
) -> CapeResult
extern "C" fn setsize( _: *mut c_void, _: CapeSize, _: *mut *mut CapeBoolean, ) -> CapeResult
Interface member function
Source§impl<'a> CapeArraySlice<'a, CapeEnumeration>
impl<'a> CapeArraySlice<'a, CapeEnumeration>
Sourceconst VTABLE_RAW: ICapeArrayEnumeration_VTable
const VTABLE_RAW: ICapeArrayEnumeration_VTable
Interface v-table
Sourceextern "C" fn get_raw(
me: *mut c_void,
data: *mut *mut CapeEnumeration,
size: *mut CapeSize,
)
extern "C" fn get_raw( me: *mut c_void, data: *mut *mut CapeEnumeration, size: *mut CapeSize, )
Interface member function
Sourceextern "C" fn setsize_raw(
_: *mut c_void,
_: CapeSize,
_: *mut *mut CapeEnumeration,
) -> CapeResult
extern "C" fn setsize_raw( _: *mut c_void, _: CapeSize, _: *mut *mut CapeEnumeration, ) -> CapeResult
Interface member function
Trait Implementations§
Auto Trait Implementations§
impl<'a, Element> Freeze for CapeArraySlice<'a, Element>
impl<'a, Element> RefUnwindSafe for CapeArraySlice<'a, Element>where
Element: RefUnwindSafe,
impl<'a, Element> Send for CapeArraySlice<'a, Element>where
Element: Sync,
impl<'a, Element> Sync for CapeArraySlice<'a, Element>where
Element: Sync,
impl<'a, Element> Unpin for CapeArraySlice<'a, Element>
impl<'a, Element> UnwindSafe for CapeArraySlice<'a, Element>where
Element: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more