1pub struct UTF16Const(pub &'static [u16]);
3impl UTF16Const {
4 #[inline]
5 pub fn as_ptr(&self) -> *const u16 {
6 self.0.as_ptr()
7 }
8 #[inline]
9 pub fn as_mut_ptr(&self) -> *mut u16 {
10 self.0.as_ptr() as *mut u16
11 }
12 #[inline]
13 pub fn len(&self) -> usize {
14 self.0.len() - 1
15 }
16}
17impl AsRef<[u16]> for UTF16Const {
18 #[inline]
19 fn as_ref(&self) -> &[u16] {
20 &self.0[..self.len()]
21 }
22}
23impl Copy for UTF16Const {}
24impl Clone for UTF16Const {
25 #[inline]
26 fn clone(&self) -> UTF16Const { *self }
27}
28pub struct UTF8Const(pub &'static str);
30impl UTF8Const {
31 #[inline]
32 pub fn as_ptr(&self) -> *const i8 {
33 self.0.as_ptr() as *const i8
34 }
35 #[inline]
36 pub fn as_mut_ptr(&self) -> *mut i8 {
37 self.0.as_ptr() as *mut i8
38 }
39 #[inline]
40 pub fn len(&self) -> usize {
41 self.0.len() - 1
42 }
43 #[inline]
44 pub fn as_str(&self) -> &str {
45 &self.0[..self.len()]
46 }
47}
48impl AsRef<str> for UTF8Const {
49 #[inline]
50 fn as_ref(&self) -> &str {
51 &self.0[..self.len()]
52 }
53}
54impl Copy for UTF8Const {}
55impl Clone for UTF8Const {
56 #[inline]
57 fn clone(&self) -> UTF8Const { *self }
58}