stable-osstring-encoding 2.0.0

Converts OsString (and more) to and from raw data with an encoding that will not change based on the compiler version.
Documentation
use crate::*;
use std::{
	ffi::{OsStr, OsString},
	os::windows::ffi::{OsStrExt, OsStringExt},
};



impl ToRawStableEncoding for OsStr {
	fn to_raw_stable_encoding(&self) -> StableOsString {
		self.encode_wide().collect::<Vec<_>>()
	}
}

impl IntoRawStableEncoding for OsString {
	fn into_raw_stable_encoding(self) -> StableOsString {
		self.as_os_str().to_raw_stable_encoding()
	}
}

impl FromRawStableEncoding for OsString {
	fn from_raw_stable_encoding<'a>(encoded: impl Into<Cow<'a, [EncodingWidth]>>) -> Self {
		Self::from_wide(&encoded.into())
	}
}