diff options
| author | Fenrir <[email protected]> | 2018-04-14 20:02:05 -0600 |
|---|---|---|
| committer | Fenrir <[email protected]> | 2018-04-21 16:35:01 -0600 |
| commit | b330206f5590d88a2f995321d2ea847ded951d1d (patch) | |
| tree | 4fecd0ca00b754c494e96b13e9837db48de93109 /ctr-std/src/sys | |
| parent | Move more implementation details to `imp` module (diff) | |
| download | ctru-rs-b330206f5590d88a2f995321d2ea847ded951d1d.tar.xz ctru-rs-b330206f5590d88a2f995321d2ea847ded951d1d.zip | |
Update for Rust nightly 2018-04-19
Diffstat (limited to 'ctr-std/src/sys')
| -rw-r--r-- | ctr-std/src/sys/unix/os_str.rs | 7 | ||||
| -rw-r--r-- | ctr-std/src/sys/unix/process.rs | 18 | ||||
| -rw-r--r-- | ctr-std/src/sys/unix/thread.rs | 2 |
3 files changed, 25 insertions, 2 deletions
diff --git a/ctr-std/src/sys/unix/os_str.rs b/ctr-std/src/sys/unix/os_str.rs index 543c22e..e0da5bd 100644 --- a/ctr-std/src/sys/unix/os_str.rs +++ b/ctr-std/src/sys/unix/os_str.rs @@ -19,7 +19,7 @@ use rc::Rc; use sync::Arc; use sys_common::{AsInner, IntoInner}; use sys_common::bytestring::debug_fmt_bytestring; -use std_unicode::lossy::Utf8Lossy; +use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] pub struct Buf { @@ -104,6 +104,11 @@ impl Buf { self.inner.shrink_to_fit() } + #[inline] + pub fn shrink_to(&mut self, min_capacity: usize) { + self.inner.shrink_to(min_capacity) + } + pub fn as_slice(&self) -> &Slice { unsafe { mem::transmute(&*self.inner) } } diff --git a/ctr-std/src/sys/unix/process.rs b/ctr-std/src/sys/unix/process.rs index f058aa9..06dafc6 100644 --- a/ctr-std/src/sys/unix/process.rs +++ b/ctr-std/src/sys/unix/process.rs @@ -16,6 +16,11 @@ use sys::pipe::AnonPipe; use sys::{unsupported, Void}; use sys_common::process::{CommandEnv, DefaultEnvKey}; +use libc::c_int; + +const EXIT_SUCCESS: c_int = 0; +const EXIT_FAILURE: c_int = 1; + //////////////////////////////////////////////////////////////////////////////// // Command //////////////////////////////////////////////////////////////////////////////// @@ -149,3 +154,16 @@ impl Process { match self.0 {} } } + +#[derive(PartialEq, Eq, Clone, Copy, Debug)] +pub struct ExitCode(u8); + +impl ExitCode { + pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _); + pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _); + + #[inline] + pub fn as_i32(&self) -> i32 { + self.0 as i32 + } +} diff --git a/ctr-std/src/sys/unix/thread.rs b/ctr-std/src/sys/unix/thread.rs index 76aa55a..694f85a 100644 --- a/ctr-std/src/sys/unix/thread.rs +++ b/ctr-std/src/sys/unix/thread.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use alloc::boxed::FnBox; +use alloc_crate::boxed::FnBox; use libc; use cmp; use ffi::CStr; |