You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: types.rs
    path of file: ./repos/phaser/phaser/vendor/winreg-0.6.2/src
    
    the code of the file until where you have to start completion: // Copyright 2015, Igor Shaula
// Licensed under the MIT License <LICENSE or
// http://opensource.org/licenses/MIT>. This file
// may not be copied, modified, or distributed
// except according to those terms.

//! Traits for loading/saving Registry values
use super::enums::*;
use super::winapi::shared::winerror;
use super::RegValue;
use super::{to_utf16, v16_to_v8};
us
    
    fn from_reg_value(val: &RegValue) -> io::Result<OsString> {
        match val.vtype {
            REG_SZ | REG_EXPAND_SZ | REG_MULTI_SZ => {
                let words = unsafe {
                    slice::from_raw_parts(val.bytes.as_ptr() as *const u16, val.bytes.len() / 2)
                };
                let s = OsString::from_wide(words);
                Ok(s)
            }
            _ => werr!(winerror::ERROR_BAD_FILE_TYPE),
        }
    }