Trait oaidl::SafeArrayElement
source · pub trait SafeArrayElementwhere
Self: Sized,{ }
Expand description
Helper trait implemented for types that can be converted into a safe array.
Implemented for types:
i8
,u8
,i16
,u16
,i32
,u32
bool
,f32
,f64
String
,Variant<T>
,Ptr<IUnknown>
,Ptr<IDispatch>
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§
impl SafeArrayElement for i16
SafeArrayElement
impl for i16
. This allows it to be converted into SAFEARRAY with vt = VT_I2
.
impl SafeArrayElement for i32
SafeArrayElement
impl for i32
. This allows it to be converted into SAFEARRAY with vt = VT_I4
.
impl SafeArrayElement for f32
SafeArrayElement
impl for f32
. This allows it to be converted into SAFEARRAY with vt = VT_R4
.
impl SafeArrayElement for f64
SafeArrayElement
impl for f64
. This allows it to be converted into SAFEARRAY with vt = VT_R8
.
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.
impl SafeArrayElement for i8
SafeArrayElement
impl for i8
. This allows it to be converted into SAFEARRAY with vt = VT_I1
.
impl SafeArrayElement for u8
SafeArrayElement
impl for u8
. This allows it to be converted into SAFEARRAY with vt = VT_UI1
.
impl SafeArrayElement for u16
SafeArrayElement
impl for u16
. This allows it to be converted into SAFEARRAY with vt = VT_UI2
.
impl SafeArrayElement for u32
SafeArrayElement
impl for u32
. This allows it to be converted into SAFEARRAY with vt = VT_UI4
.
Implementors§
impl SafeArrayElement for Currency
SafeArrayElement
impl for Currency
:struct.Currency.html . This allows it to be converted into SAFEARRAY with vt = VT_CY
.
impl SafeArrayElement for Date
SafeArrayElement
impl for [‘Date’]: struct.Date.html. This allows it to be converted into SAFEARRAY with vt = VT_DATE
.
impl SafeArrayElement for DecWrapper
SafeArrayElement
impl for [‘DecWrapper’]. This allows it to be converted into SAFEARRAY with vt = VT_DECIMAL
.
impl SafeArrayElement for Int
SafeArrayElement
impl for Int
. This allows it to be converted into SAFEARRAY with vt = VT_INT
.
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_safearrayand
into_safearray` because *mut IDispatch doesn’t need
an additional indirection to be put into a SAFEARRAY.
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_safearrayand
into_safearray` because *mut IUnknown doesn’t need
an additional indirection to be put into a SAFEARRAY.
impl SafeArrayElement for SCode
SafeArrayElement
impl for [‘SCode’]. This allows it to be converted into SAFEARRAY with vt = VT_ERROR
.
impl SafeArrayElement for UInt
SafeArrayElement
impl for UInt
. This allows it to be converted into SAFEARRAY with vt = VT_INT
.
impl SafeArrayElement for VariantBool
SafeArrayElement
impl for [‘VariantBool’]. This allows it to be converted into SAFEARRAY with vt = VT_BOOL
.
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_safearrayand
into_safearraybecause
*mut VARIANTdoesn't need an additional indirection to be put into a
SAFEARRAY`.