win-variant 0.1.2

This is a rust crate that aims to provide a more ergonomic way of working with variants in winapi based projects.
Documentation
use std::string::FromUtf16Error;

use thiserror::Error;
use widestring::NulError;
use winapi::shared::wtypes::VARTYPE;

#[derive(Debug, Error)]
pub enum VariantArgError {
    #[error("wide char parsing error: {0}")]
    ToWideCharArrayError(NulError<u16>),
}

impl From<NulError<u16>> for VariantArgError {
    fn from(e: NulError<u16>) -> Self {
        VariantArgError::ToWideCharArrayError(e)
    }
}

#[derive(Debug, Error)]
pub enum VariantResultError {
    #[error("UTF-16 parse error: {0}")]
    FromUtf16(FromUtf16Error),
    #[error("unsupported type conversion to type `{0}`")]
    UnsupportedTypeConversion(VARTYPE),
}

impl From<FromUtf16Error> for VariantResultError {
    fn from(e: FromUtf16Error) -> Self {
        VariantResultError::FromUtf16(e)
    }
}