Trait SafeArrayElement

Source
pub trait SafeArrayElement
where 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(())
}

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SafeArrayElement for f32

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

Source§

impl SafeArrayElement for f64

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

Source§

impl SafeArrayElement for i8

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

Source§

impl SafeArrayElement for i16

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

Source§

impl SafeArrayElement for i32

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

Source§

impl SafeArrayElement for u8

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

Source§

impl SafeArrayElement for u16

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

Source§

impl SafeArrayElement for u32

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

Source§

impl SafeArrayElement for U16String

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.

Implementors§

Source§

impl SafeArrayElement for Currency

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

Source§

impl SafeArrayElement for Date

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

Source§

impl SafeArrayElement for DecWrapper

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

Source§

impl SafeArrayElement for Int

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

Source§

impl SafeArrayElement for Ptr<IDispatch>

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.

Source§

impl SafeArrayElement for Ptr<IUnknown>

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.

Source§

impl SafeArrayElement for SCode

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

Source§

impl SafeArrayElement for UInt

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

Source§

impl SafeArrayElement for VariantBool

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

Source§

impl<D, T> SafeArrayElement for Variant<D, T>
where D: VariantExt<T>,

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`.