cobia/
cape_string_win32.rs

1use crate::C;
2use crate::*;
3
4/// CapeStringIn wraps an ICapeString interface pointer as read-only.
5///
6/// Given an reference to an ICapeString interface pointer, this allows getting,
7/// but not setting, the string.This is used for strings that are
8/// input arguments to methods.
9///
10/// This interface is not typically used directly as pre-generated
11/// wrappers provide input strings as str and return values as
12/// Result<&str,cobia::COBIAError>. However, for 
13/// CapeArrayStringIn elements, this interface is used.
14///
15/// A NULL interface pointer is treated as an empty string.
16///
17/// # Examples
18///
19/// ```
20/// use cobia::*;
21///
22/// fn test_string(s: &CapeStringIn) {
23///     assert_eq!(s.as_string(),"idealGasEnthalpy");
24/// }
25/// 
26/// let mut s1=cobia::CapeStringImpl::from("idealGasEnthalpy");
27/// test_string(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
28/// ```
29
30#[derive(Debug)]
31pub struct CapeStringIn<'a> {
32	interface: &'a *mut C::ICapeString,
33	slice: &'a [u16]
34}
35
36impl<'a> CapeStringIn<'a> {
37	/// Create a new CapeStringIn from an ICapeString interface pointer.
38	///
39	/// # Arguments
40	///
41	/// * `interface` - A pointer to an ICapeString interface
42	///
43	/// # Examples
44	///
45	/// ```
46	/// use cobia::*;
47	/// use cobia::prelude::*;
48	/// let mut s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
49	///	let i_cape_string=s1.as_cape_string_out();
50	///	let mut i_cape_string_ptr=(&i_cape_string as *const C::ICapeString).cast_mut(); //normally a pointer to the interface is received
51	///	let s = cobia::CapeStringIn::new(&i_cape_string_ptr); //CapeStringIn from *mut C::ICapeString
52	/// assert_eq!(s.as_string(),"idealGasEnthalpy");
53	/// ```
54
55	pub fn new(interface: &'a *mut C::ICapeString) -> CapeStringIn<'a> {
56		let mut slice: &[u16] = &[];
57		if !interface.is_null() {
58			let mut data: *const u16 = std::ptr::null_mut();
59			let mut size: C::CapeSize = 0;
60			unsafe {
61				(*(**interface).vTbl).get.unwrap()(
62					(**interface).me,
63					&mut data as *mut *const u16,
64					&mut size as *mut C::CapeSize,
65				)
66			}
67			if (!data.is_null()) && (size != 0) {
68				slice=unsafe { std::slice::from_raw_parts(data, size as usize + 1) }; //include the terminating null
69			}
70		}
71		CapeStringIn { 
72			interface,
73			slice			
74		}
75	}
76
77	/// Return the content of the string as a string.
78	///
79	/// # Examples
80	///
81	/// ```
82	/// use cobia::*;
83	///
84	/// fn test_string(s: &CapeStringIn) {
85	///     assert_eq!(s.as_string(),"idealGasEnthalpy");
86	/// }
87	/// 
88	/// let mut s1=cobia::CapeStringImpl::from("idealGasEnthalpy");
89	/// test_string(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
90	/// ```
91
92	pub fn as_string(&self) -> String {
93		if self.slice.is_empty() {
94			return String::new();
95		}
96		String::from_utf16_lossy(&self.slice[0..self.slice.len()-1]) //exclude null
97	}
98
99	/// Return the string as a slice
100	///
101	/// Note that for empty strings, the null terminator may
102	/// not be included, so check for a zero length slice.
103
104	pub fn as_slice(&self) -> &[C::CapeCharacter] {
105		self.slice
106	}
107
108	/// Case insentitive comparison
109	/// 
110	/// # Arguments
111	///	
112	/// * `other` - The other string to compare to
113	///
114	/// # Examples
115	///
116	/// ```
117	/// use cobia::*;
118	///
119	/// fn test_string(s: &CapeStringIn) {
120	///		let s2=cobia::CapeStringImpl::from_string("IDEALGASENTHALPY");
121	///     assert_eq!(s.eq_ignore_case(&s2),true);
122	/// }
123	/// 
124	/// let s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
125	/// test_string(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
126	/// ```
127	pub fn eq_ignore_case<T:CapeStringConstProvider>(&self, other: &T) -> bool {
128		let (ptr,len)=other.as_capechar_const_with_length();
129		let slice=self.as_slice();
130		let mut slice_len=slice.len();
131		if slice_len>0 {
132			slice_len-=1;
133		}
134		let len=len as usize;
135		if slice_len == len {
136			let mut ptr=ptr;
137			for i in 0..len {
138				if CapeStringImpl::to_lower_case(unsafe { *ptr }) != CapeStringImpl::to_lower_case(slice[i]) {
139					return false;
140				}
141				ptr=unsafe { ptr.add(1) };
142			}
143			return true;			
144		}
145		false
146	}
147
148	/// Case sentitive comparison
149	/// 
150	/// # Arguments
151	///	
152	/// * `other` - The other string to compare to
153	///
154	/// # Examples
155	///
156	/// ```
157	/// use cobia::*;
158	///
159	/// fn test_string(s: &CapeStringIn) {
160	///		let s2=cobia::CapeStringImpl::from_string("IDEALGASENTHALPY");
161	///		assert_eq!(s.eq(&s2),false);
162	///		let s3=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
163	///		assert_eq!(s.eq(&s3),true);
164	/// }
165	/// 
166	/// let s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
167	/// test_string(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
168	/// ```
169	pub fn eq<T:CapeStringConstProvider>(&self, other: &T) -> bool {
170		let (ptr,len)=other.as_capechar_const_with_length();
171		let slice=self.as_slice();
172		let mut slice_len=slice.len();
173		if slice_len>0 {
174			slice_len-=1;
175		}
176		let len=len as usize;
177		if slice_len == len {
178			let mut ptr=ptr;
179			for i in 0..len {
180				if unsafe { *ptr } != slice[i] {
181					return false;
182				}
183				ptr=unsafe { ptr.add(1) };
184			}
185			return true;			
186		}
187		false
188	}
189
190	/// Check empty
191	///
192	/// # Examples
193	///
194	/// ```
195	/// use cobia::*;
196	///
197	/// fn test_empty(s: &CapeStringIn) {
198	///		assert_eq!(s.is_empty(),true);
199	/// }
200	/// 
201	/// let s1=cobia::CapeStringImpl::new();
202	/// test_empty(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
203	/// ```
204
205	pub fn is_empty(&self) -> bool {
206		(self.slice.is_empty())||(self.slice[0]==0u16)
207	}
208
209}
210
211impl<'a,T:CapeStringConstProvider> PartialEq<T> for CapeStringIn<'a> {
212	/// Compare the CapeStringIn with a string slice or any object that implements
213	/// CapeStringConstProvider.
214	///
215	/// # Examples
216	///
217	/// ```
218	/// use cobia::*;
219	///
220	/// fn test_string(s: &CapeStringIn) {
221	///		let s2=cobia::CapeStringImpl::from_string("IDEALGASENTHALPY");
222	///		assert_ne!(s,&s2);
223	///		let s3=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
224	///		assert_eq!(s,&s3);
225	/// }
226	/// 
227	/// let s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
228	/// test_string(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
229	/// ```
230	fn eq(&self, other: &T) -> bool {
231		self.eq(other)
232	}
233}
234
235impl<'a> CapeStringConstProvider for CapeStringIn<'a> {
236	///Return as CapeCharacter const pointer with length
237	///
238	/// The caller must ensure that the lifetime of the CapeStringImpl
239	/// is longer than the pointer returned.
240	///
241	/// # Examples
242	///
243	/// ```
244	/// use cobia::*;
245	///
246	/// fn test_string(s: &CapeStringIn) {
247	///		let (ptr,len)=s.as_capechar_const_with_length(); ///... while ptr is used
248	///		assert_eq!(len,16);
249	/// }
250	/// 
251	/// let s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
252	/// test_string(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
253	/// ```
254	fn as_capechar_const_with_length(&self) -> (*const C::CapeCharacter, C::CapeSize) {
255		if self.slice.is_empty() {
256			("\0\0".as_ptr() as *const C::CapeCharacter,0 as C::CapeSize)
257		} else {
258			(self.slice.as_ptr(),(self.slice.len()-1) as C::CapeSize)
259		}
260	}
261	///Return as CapeCharacter const pointer
262	///
263	/// The caller must ensure that the lifetime of the CapeStringImpl
264	/// is longer than the pointer returned.
265	///
266	/// # Examples
267	///
268	/// ```
269	/// use cobia::*;
270	///
271	/// fn test_string(s: &CapeStringIn) {
272	///		let (ptr,len)=s.as_capechar_const_with_length(); ///... while ptr is used
273	///		assert_eq!(unsafe{*ptr},'i' as u16);
274	/// }
275	/// 
276	/// let s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
277	/// test_string(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
278	/// ```
279	fn as_capechar_const(&self) -> *const C::CapeCharacter {
280		if self.slice.is_empty() {
281			"\0\0".as_ptr() as *const C::CapeCharacter
282		} else {
283			self.slice.as_ptr()
284		}
285	}
286}
287
288impl<'a> std::fmt::Display for CapeStringIn<'a> {
289	/// Formats the CapeStringIn error using the given formatter.
290	///
291	/// # Examples
292	///
293	/// ```
294	/// use cobia::*;
295	///
296	/// fn test_format(s: &CapeStringIn) {
297	///		assert_eq!(format!("{}",s),"idealGasEnthalpy");
298	/// }
299	/// 
300	/// let s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
301	/// test_format(&CapeStringInFromProvider::from(&s1).as_cape_string_in())
302	/// ```
303
304	fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
305		write!(f, "{}", self.as_string())
306	}
307}
308
309impl<'a> CapeStringProviderIn for CapeStringIn<'a> {
310
311	fn as_cape_string_in(&self) -> C::ICapeString {
312		unsafe { **self.interface }
313	}
314
315}
316
317/// CapeStringOut wraps an ICapeString interface pointer.
318///
319/// Given an ICapeString interface pointer, this allows setting
320///  and getting the string.
321///
322/// This interface is not typically used directly as pre-generated
323/// wrappers provide input strings as str and return values as
324/// Result<&str,cobia::COBIAError>. However for output values and
325/// CapeArrayStringOut elements, this interface is used.
326///
327/// NULL pointers are not allowed.
328///
329/// # Examples
330///
331/// ```
332/// use cobia::*;
333///
334/// fn set_content(s: &mut CapeStringOut) {
335///		s.set_string("idealGasEnthalpy").unwrap();
336/// }
337/// 
338/// let mut s1=cobia::CapeStringImpl::new();
339/// set_content(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
340/// assert_eq!(s1.as_string(),"idealGasEnthalpy");
341/// ```
342
343#[derive(Debug)]
344pub struct CapeStringOut<'a> {
345	interface: &'a mut *mut C::ICapeString,
346}
347
348impl<'a> CapeStringOut<'a> {
349	/// Create a new CapeStringOut from an ICapeString interface pointer.
350	///
351	/// # Arguments
352	///
353	/// * `interface` - A pointer to an ICapeString interface
354	///
355	/// # Examples
356	///
357	/// ```
358	/// use cobia::*;
359	/// use cobia::prelude::*;
360	/// let mut s1=cobia::CapeStringImpl::from("idealGasEnthalpy");
361	/// let i_cape_string=s1.as_cape_string_out();
362	///	let mut i_cape_string_ptr=(&i_cape_string as *const C::ICapeString).cast_mut(); //normally a pointer to the interface is received
363	///	let s = cobia::CapeStringOut::new(&mut i_cape_string_ptr); //CapeStringOut from *mut C::ICapeString
364	/// assert_eq!(s.as_string(),"idealGasEnthalpy");
365	/// ```
366
367	pub fn new(interface: &'a mut *mut C::ICapeString) -> CapeStringOut<'a> {
368		CapeStringOut { interface }
369	}
370
371	/// Return the content of the string as a string.
372	///
373	/// # Examples
374	///
375	/// ```
376	/// use cobia::*;
377	///
378	/// fn check_content(s: &mut CapeStringOut) {
379	///		assert_eq!(s.as_string(),"idealGasEnthalpy"); //return as string
380	/// }
381	/// 
382	/// let mut s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
383	/// check_content(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
384	/// ```
385
386	pub fn as_string(&self) -> String {
387		let mut data: *const u16 = std::ptr::null_mut();
388		let mut size: C::CapeSize = 0;
389		unsafe {
390			(*(**self.interface).vTbl).get.unwrap()(
391				(**self.interface).me,
392				&mut data as *mut *const u16,
393				&mut size as *mut C::CapeSize,
394			)
395		}
396		if (data.is_null()) || (size == 0) {
397			return String::new();
398		}
399		let slice = unsafe { std::slice::from_raw_parts(data, size as usize) };
400		String::from_utf16_lossy(slice)
401	}
402
403	/// Set the content of the string any CAPE-OPEN string
404	///
405	/// # Arguments
406	///
407	/// * `s` - An object implementing CapeStringConstProvider
408	///
409	/// # Examples
410	///
411	/// ```
412	/// use cobia::*;
413	///
414	/// fn set_content(s: &mut CapeStringOut) {
415	///		let s0=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
416	///		s.set(&s0).unwrap();
417	/// }
418	/// 
419	/// let mut s1=cobia::CapeStringImpl::new();
420	/// set_content(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
421	/// assert_eq!(s1.as_string(),"idealGasEnthalpy");
422	/// ```
423	pub fn set<T:CapeStringConstProvider>(&self, s: &T) -> Result<(), COBIAError> {
424		let (ptr, sz) = s.as_capechar_const_with_length();
425		let result =
426			unsafe { (*(**self.interface).vTbl).set.unwrap()((**self.interface).me, ptr, sz) };
427		if result == COBIAERR_NOERROR {
428			Ok(())
429		} else {
430			Err(COBIAError::Code(result))
431		}
432	}
433
434	/// Set the content of the string from a string slice.
435	///
436	/// # Arguments
437	///
438	/// * `s` - A string slice
439	///
440	/// # Examples
441	///
442	/// ```
443	/// use cobia::*;
444	///
445	/// fn set_content(s: &mut CapeStringOut) {
446	///		s.set_string("idealGasEnthalpy").unwrap();
447	/// }
448	/// 
449	/// let mut s1=cobia::CapeStringImpl::new();
450	/// set_content(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
451	/// assert_eq!(s1.as_string(),"idealGasEnthalpy");
452	/// ```
453	pub fn set_string<T: AsRef<str>>(&self, s: T) -> Result<(), COBIAError> {
454		self.set(&CapeStringImpl::from_string(s.as_ref()))
455	}
456
457	/// Case insentitive comparison
458	/// 
459	/// # Arguments
460	///	
461	/// * `other` - The other string to compare to
462	///
463	/// # Examples
464	///
465	/// ```
466	/// use cobia::*;
467	/// 
468	/// fn check_string(s: &mut CapeStringOut) {
469	///	    let s2=cobia::CapeStringImpl::from_string("IDEALGASENTHALPY");
470	///		assert_eq!(s.eq_ignore_case(&s2),true);
471	/// }
472	/// 
473	/// let mut s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
474	/// check_string(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
475	/// ```
476	pub fn eq_ignore_case<T:CapeStringConstProvider>(&self, other: &T) -> bool {
477		let (ptr,len)=other.as_capechar_const_with_length();
478		let mut data: *const u16 = std::ptr::null_mut();
479		let mut size: C::CapeSize = 0;
480		unsafe {
481			(*(**self.interface).vTbl).get.unwrap()(
482				(**self.interface).me,
483				&mut data as *mut *const u16,
484				&mut size as *mut C::CapeSize,
485			)
486		}
487		if size == len {
488			let mut ptr=ptr;
489			let mut ptr1=data;
490			let ptr_end=unsafe { ptr.add(len as usize) };
491			while ptr!=ptr_end {
492				if CapeStringImpl::to_lower_case(unsafe { *ptr }) != CapeStringImpl::to_lower_case(unsafe { *ptr1 }) {
493					return false;
494				}
495				ptr=unsafe { ptr.add(1) };
496				ptr1=unsafe { ptr1.add(1) };
497			}
498			return true;			
499		}
500		false
501	}
502
503	/// Case sentitive comparison
504	/// 
505	/// # Arguments
506	///	
507	/// * `other` - The other string to compare to
508	///
509	/// # Examples
510	///
511	/// ```
512	/// use cobia::*;
513	///
514	/// fn test_string(s: &CapeStringOut) {
515	///		let s2=cobia::CapeStringImpl::from_string("IDEALGASENTHALPY");
516	///		assert_eq!(s.eq(&s2),false);
517	///		let s3=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
518	///		assert_eq!(s.eq(&s3),true);
519	/// }
520	/// 
521	/// let mut s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
522	/// test_string(&CapeStringOutFromProvider::from(&mut s1).as_cape_string_out())
523	/// ```
524	pub fn eq<T:CapeStringConstProvider>(&self, other: &T) -> bool {
525		let (ptr_other,len_other)=other.as_capechar_const_with_length();
526		let (ptr_self,len_self)=self.as_capechar_const_with_length();
527		if len_self == len_other {
528			let mut ptr_self=ptr_self;
529			let mut ptr_other=ptr_other;
530			for _ in 0..len_self {
531				if unsafe { *ptr_self } != unsafe { *ptr_other } {
532					return false;
533				}
534				ptr_self=unsafe { ptr_self.add(1) };
535				ptr_other=unsafe { ptr_other.add(1) };	
536			}
537			return true;
538		}
539		false
540	}
541
542	/// Check empty
543	///
544	/// # Examples
545	///
546	/// ```
547	/// use cobia::*;
548	/// 
549	/// fn check_empty(s: &mut CapeStringOut) {
550	///	    assert_eq!(s.is_empty(),true);
551	/// }
552	/// 
553	/// let mut s1=cobia::CapeStringImpl::new();
554	/// check_empty(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
555	/// ```
556	pub fn is_empty(&self) -> bool {
557		let mut data: *const u16 = std::ptr::null_mut();
558		let mut size: C::CapeSize = 0;
559		unsafe {
560			(*(**self.interface).vTbl).get.unwrap()(
561				(**self.interface).me,
562				&mut data as *mut *const u16,
563				&mut size as *mut C::CapeSize,
564			)
565		}
566		(data.is_null()) || (size == 0)
567	}
568
569}
570
571impl<'a,T:CapeStringConstProvider> PartialEq<T> for CapeStringOut<'a> {
572	/// Compare the CapeStringOut with a string slice or any object that implements
573	/// CapeStringConstProvider.
574	///
575	/// # Examples
576	///
577	/// ```
578	/// use cobia::*;
579	///
580	/// fn test_string(s: &mut CapeStringOut) {
581	///		let s2=cobia::CapeStringImpl::from_string("IDEALGASENTHALPY");
582	///		assert_ne!(s,&s2);
583	///		let s3=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
584	///		assert_eq!(s,&s3);
585	/// }
586	/// 
587	/// let mut s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
588	/// test_string(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out())
589	/// ```
590	fn eq(&self, other: &T) -> bool {
591		self.eq(other)
592	}
593}
594
595impl<'a> CapeStringConstProvider for CapeStringOut<'a> {
596	///Return as CapeCharacter const pointer with length
597	///
598	/// The caller must ensure that the lifetime of the CapeStringImpl
599	/// is longer than the pointer returned.
600	///
601	/// # Examples
602	///
603	/// ```
604	/// use cobia::*;
605	/// 
606	/// fn check_size(s: &mut CapeStringOut) {
607	///     let (ptr,len)=s.as_capechar_const_with_length();
608	///	    assert_eq!(len,16);
609	/// }
610	/// 
611	/// let mut s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
612	/// check_size(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
613	/// ```
614	fn as_capechar_const_with_length(&self) -> (*const C::CapeCharacter, C::CapeSize) {
615		if self.interface.is_null() {
616			("\0\0".as_ptr() as *const C::CapeCharacter,0 as C::CapeSize)
617		} else {
618			let mut data: *const u16 = std::ptr::null_mut();
619			let mut size: C::CapeSize = 0;
620			unsafe {
621				(*(**self.interface).vTbl).get.unwrap()(
622					(**self.interface).me,
623					&mut data as *mut *const u16,
624					&mut size as *mut C::CapeSize,
625				)
626			}
627			if (data.is_null()) || (size == 0) {
628				("\0\0".as_ptr() as *const C::CapeCharacter,0 as C::CapeSize)
629			} else {
630				(data as *const C::CapeCharacter,size)
631			}
632		}
633	}
634	///Return as CapeCharacter const pointer with length
635	///
636	/// The caller must ensure that the lifetime of the CapeStringImpl
637	/// is longer than the pointer returned.
638	///
639	/// # Examples
640	///
641	/// ```
642	/// use cobia::*;
643	/// 
644	/// fn check_ptr(s: &mut CapeStringOut) {
645	///		let ptr=s.as_capechar_const(); ///... while ptr is used
646	///		assert_eq!(unsafe{*ptr},'i' as u16);
647	/// }
648	/// 
649	/// let mut s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
650	/// check_ptr(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
651	/// ```
652	fn as_capechar_const(&self) -> *const C::CapeCharacter {
653		if self.interface.is_null() {
654			"\0\0".as_ptr() as *const C::CapeCharacter
655		} else {
656			let mut data: *const u16 = std::ptr::null_mut();
657			let mut size: C::CapeSize = 0;
658			unsafe {
659				(*(**self.interface).vTbl).get.unwrap()(
660					(**self.interface).me,
661					&mut data as *mut *const u16,
662					&mut size as *mut C::CapeSize,
663				)
664			}
665			if (data.is_null()) || (size == 0) {
666				"\0\0".as_ptr() as *const C::CapeCharacter
667			} else {
668				data as *const C::CapeCharacter
669			}
670		}
671	}
672}
673
674
675impl<'a> std::fmt::Display for CapeStringOut<'a> {
676	/// Formats the CapeStringOut error using the given formatter.
677	///
678	/// # Examples
679	///
680	/// ```
681	/// use cobia::*;
682	/// 
683	/// fn check_format(s: &mut CapeStringOut) {
684	///		let ptr=s.as_capechar_const(); ///... while ptr is used
685	///		assert_eq!(format!("{}",s),"idealGasEnthalpy");
686	/// }
687	/// 
688	/// let mut s1=cobia::CapeStringImpl::from_string("idealGasEnthalpy");
689	/// check_format(&mut CapeStringOutFromProvider::from(&mut s1).as_cape_string_out());
690	/// ```
691	fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
692		write!(f, "{}", self.as_string())
693	}
694}
695
696impl<'a> CapeStringProviderOut for CapeStringOut<'a> {
697	fn as_cape_string_out(&mut self) -> C::ICapeString {
698		unsafe { **self.interface }
699	}
700}
701