pub trait SafeArrayElementwhere
    Self: Sized,
{ }
Expand description

Helper trait implemented for types that can be converted into a safe array.

Implemented for types:

Example usage

Generally, you shouldn’t implement this on your types without great care. Therefore this example only shows the basic interface, but not implementation details.

extern crate oaidl;
extern crate winapi;
 
use std::vec::IntoIter;
use oaidl::{SafeArrayElement, SafeArrayExt, SafeArrayError};
 
fn main() -> Result<(), SafeArrayError> {
    let v = vec![-3i16, -2, -1, 0, 1, 2, 3];
    let arr = v.into_iter().into_safearray()?;
    let out = IntoIter::<i16>::from_safearray(arr)?;    
    println!("{:?}", out);
    Ok(())
}

Implementations on Foreign Types§

SafeArrayElement impl for i16. This allows it to be converted into SAFEARRAY with vt = VT_I2.

SafeArrayElement impl for i32. This allows it to be converted into SAFEARRAY with vt = VT_I4.

SafeArrayElement impl for f32. This allows it to be converted into SAFEARRAY with vt = VT_R4.

SafeArrayElement impl for f64. This allows it to be converted into SAFEARRAY with vt = VT_R8.

SafeArrayElement impl for U16String. This allows it to be converted into SAFEARRAY with vt = VT_BSTR. This overrides the default implementation of into_safearray because *mut *mut u16 is the incorrect type to put in a SAFEARRAY.

SafeArrayElement impl for i8. This allows it to be converted into SAFEARRAY with vt = VT_I1.

SafeArrayElement impl for u8. This allows it to be converted into SAFEARRAY with vt = VT_UI1.

SafeArrayElement impl for u16. This allows it to be converted into SAFEARRAY with vt = VT_UI2.

SafeArrayElement impl for u32. This allows it to be converted into SAFEARRAY with vt = VT_UI4.

Implementors§

SafeArrayElement impl for Currency:struct.Currency.html . This allows it to be converted into SAFEARRAY with vt = VT_CY.

SafeArrayElement impl for [‘Date’]: struct.Date.html. This allows it to be converted into SAFEARRAY with vt = VT_DATE.

SafeArrayElement impl for [‘DecWrapper’]. This allows it to be converted into SAFEARRAY with vt = VT_DECIMAL.

SafeArrayElement impl for Int. This allows it to be converted into SAFEARRAY with vt = VT_INT.

SafeArrayElementimpl for ['Ptr<IDispatch>']. This allows it to be converted into SAFEARRAY with vt =VT_DISPATCH. This overrides the default impl of from_safearrayandinto_safearray` because *mut IDispatch doesn’t need an additional indirection to be put into a SAFEARRAY.

SafeArrayElementimpl for ['Ptr<IUnknown>']. This allows it to be converted into SAFEARRAY with vt =VT_UNKNOWN. This overrides the default impl of from_safearrayandinto_safearray` because *mut IUnknown doesn’t need an additional indirection to be put into a SAFEARRAY.

SafeArrayElement impl for [‘SCode’]. This allows it to be converted into SAFEARRAY with vt = VT_ERROR.

SafeArrayElement impl for UInt. This allows it to be converted into SAFEARRAY with vt = VT_INT.

SafeArrayElement impl for [‘VariantBool’]. This allows it to be converted into SAFEARRAY with vt = VT_BOOL.

SafeArrayElementimpl for ['Variant<D,T>']. This allows it to be converted into SAFEARRAY with vt =VT_VARIANT. This overrides the default impl of from_safearrayandinto_safearraybecause*mut VARIANTdoesn't need an additional indirection to be put into aSAFEARRAY`.