Lines Matching refs:io
9 use crate::io;
47 /// use rustix::io;
52 /// pub fn touch<P: Arg>(path: P) -> io::Result<()> {
58 /// fn _touch(path: &CStr) -> io::Result<()> {
70 fn as_str(&self) -> io::Result<&str>;
77 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>>;
81 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
86 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
89 F: FnOnce(&CStr) -> io::Result<T>;
94 fn as_str(&self) -> io::Result<&str> {
104 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
106 CString::new(*self).map_err(|_cstr_err| io::Errno::INVAL)?,
111 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
116 CString::new(self).map_err(|_cstr_err| io::Errno::INVAL)?,
121 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
124 F: FnOnce(&CStr) -> io::Result<T>,
132 fn as_str(&self) -> io::Result<&str> {
142 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
144 CString::new(String::as_str(self)).map_err(|_cstr_err| io::Errno::INVAL)?,
149 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
157 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
160 F: FnOnce(&CStr) -> io::Result<T>,
168 fn as_str(&self) -> io::Result<&str> {
178 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
180 CString::new(self.as_str()).map_err(|_cstr_err| io::Errno::INVAL)?,
185 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
190 CString::new(self).map_err(|_cstr_err| io::Errno::INVAL)?,
195 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
198 F: FnOnce(&CStr) -> io::Result<T>,
200 f(&CString::new(self).map_err(|_cstr_err| io::Errno::INVAL)?)
207 fn as_str(&self) -> io::Result<&str> {
208 self.to_str().ok_or(io::Errno::INVAL)
217 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
219 CString::new(self.as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
224 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
229 CString::new(self.as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
234 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
237 F: FnOnce(&CStr) -> io::Result<T>,
246 fn as_str(&self) -> io::Result<&str> {
247 OsString::as_os_str(self).to_str().ok_or(io::Errno::INVAL)
256 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
259 .map_err(|_cstr_err| io::Errno::INVAL)?,
264 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
272 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
275 F: FnOnce(&CStr) -> io::Result<T>,
284 fn as_str(&self) -> io::Result<&str> {
285 self.as_os_str().to_str().ok_or(io::Errno::INVAL)
294 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
296 CString::new(self.as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
301 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
306 CString::new(self.into_vec()).map_err(|_cstr_err| io::Errno::INVAL)?,
311 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
314 F: FnOnce(&CStr) -> io::Result<T>,
316 f(&CString::new(self.into_vec()).map_err(|_cstr_err| io::Errno::INVAL)?)
323 fn as_str(&self) -> io::Result<&str> {
324 self.as_os_str().to_str().ok_or(io::Errno::INVAL)
333 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
335 CString::new(self.as_os_str().as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
340 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
345 CString::new(self.as_os_str().as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
350 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
353 F: FnOnce(&CStr) -> io::Result<T>,
362 fn as_str(&self) -> io::Result<&str> {
366 .ok_or(io::Errno::INVAL)
375 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
378 .map_err(|_cstr_err| io::Errno::INVAL)?,
383 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
391 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
394 F: FnOnce(&CStr) -> io::Result<T>,
403 fn as_str(&self) -> io::Result<&str> {
404 self.as_os_str().to_str().ok_or(io::Errno::INVAL)
413 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
415 CString::new(self.as_os_str().as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
420 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
425 CString::new(self.into_os_string().into_vec()).map_err(|_cstr_err| io::Errno::INVAL)?,
430 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
433 F: FnOnce(&CStr) -> io::Result<T>,
437 .map_err(|_cstr_err| io::Errno::INVAL)?,
444 fn as_str(&self) -> io::Result<&str> {
445 self.to_str().map_err(|_utf8_err| io::Errno::INVAL)
454 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
459 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
467 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
470 F: FnOnce(&CStr) -> io::Result<T>,
478 fn as_str(&self) -> io::Result<&str> {
488 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
493 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
501 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
504 F: FnOnce(&CStr) -> io::Result<T>,
512 fn as_str(&self) -> io::Result<&str> {
513 self.to_str().map_err(|_utf8_err| io::Errno::INVAL)
522 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
527 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
535 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
538 F: FnOnce(&CStr) -> io::Result<T>,
546 fn as_str(&self) -> io::Result<&str> {
556 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
558 CString::new(self.as_ref()).map_err(|_cstr_err| io::Errno::INVAL)?,
563 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
572 .map_err(|_cstr_err| io::Errno::INVAL)?,
577 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
580 F: FnOnce(&CStr) -> io::Result<T>,
589 fn as_str(&self) -> io::Result<&str> {
590 (**self).to_str().ok_or(io::Errno::INVAL)
599 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
601 CString::new(self.as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
606 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
615 .map_err(|_cstr_err| io::Errno::INVAL)?,
620 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
623 F: FnOnce(&CStr) -> io::Result<T>,
631 fn as_str(&self) -> io::Result<&str> {
632 self.to_str().map_err(|_utf8_err| io::Errno::INVAL)
642 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
647 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
655 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
658 F: FnOnce(&CStr) -> io::Result<T>,
667 fn as_str(&self) -> io::Result<&str> {
668 self.as_os_str().to_str().ok_or(io::Errno::INVAL)
677 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
679 CString::new(self.as_os_str().as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
684 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
689 CString::new(self.as_os_str().as_bytes()).map_err(|_cstr_err| io::Errno::INVAL)?,
694 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
697 F: FnOnce(&CStr) -> io::Result<T>,
706 fn as_str(&self) -> io::Result<&str> {
707 self.as_path().to_str().ok_or(io::Errno::INVAL)
716 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
719 .map_err(|_cstr_err| io::Errno::INVAL)?,
724 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
730 .map_err(|_cstr_err| io::Errno::INVAL)?,
735 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
738 F: FnOnce(&CStr) -> io::Result<T>,
747 fn as_str(&self) -> io::Result<&str> {
748 self.as_path().to_str().ok_or(io::Errno::INVAL)
757 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
760 .map_err(|_cstr_err| io::Errno::INVAL)?,
765 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
771 .map_err(|_cstr_err| io::Errno::INVAL)?,
776 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
779 F: FnOnce(&CStr) -> io::Result<T>,
787 fn as_str(&self) -> io::Result<&str> {
788 str::from_utf8(self).map_err(|_utf8_err| io::Errno::INVAL)
797 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
799 CString::new(*self).map_err(|_cstr_err| io::Errno::INVAL)?,
804 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
809 CString::new(self).map_err(|_cstr_err| io::Errno::INVAL)?,
814 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
817 F: FnOnce(&CStr) -> io::Result<T>,
825 fn as_str(&self) -> io::Result<&str> {
826 str::from_utf8(self).map_err(|_utf8_err| io::Errno::INVAL)
835 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
837 CString::new(self.as_slice()).map_err(|_cstr_err| io::Errno::INVAL)?,
842 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
847 CString::new(self.as_slice()).map_err(|_cstr_err| io::Errno::INVAL)?,
852 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
855 F: FnOnce(&CStr) -> io::Result<T>,
863 fn as_str(&self) -> io::Result<&str> {
864 str::from_utf8(self).map_err(|_utf8_err| io::Errno::INVAL)
873 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
875 CString::new(self.as_slice()).map_err(|_cstr_err| io::Errno::INVAL)?,
880 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
885 CString::new(self).map_err(|_cstr_err| io::Errno::INVAL)?,
890 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
893 F: FnOnce(&CStr) -> io::Result<T>,
895 f(&CString::new(self).map_err(|_cstr_err| io::Errno::INVAL)?)
902 fn as_str(&self) -> io::Result<&str> {
912 fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
917 fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
925 fn into_with_c_str<T, F>(self, f: F) -> io::Result<T>
928 F: FnOnce(&CStr) -> io::Result<T>,
937 fn with_c_str<T, F>(bytes: &[u8], f: F) -> io::Result<T>
939 F: FnOnce(&CStr) -> io::Result<T>,
969 Err(_) => Err(io::Errno::INVAL),
976 fn with_c_str_slow_path<T, F>(bytes: &[u8], f: F) -> io::Result<T>
978 F: FnOnce(&CStr) -> io::Result<T>,
980 f(&CString::new(bytes).map_err(|_cstr_err| io::Errno::INVAL)?)