2014-11-25 15:28:35 -06:00
|
|
|
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
//! Utilities related to FFI bindings.
|
|
|
|
|
2015-03-02 12:46:05 -06:00
|
|
|
#![stable(feature = "rust1", since = "1.0.0")]
|
2014-11-25 15:28:35 -06:00
|
|
|
|
2015-03-02 12:46:05 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
pub use self::c_str::{CString, CStr};
|
|
|
|
pub use self::c_str::{NulError, IntoBytes};
|
2015-02-18 00:47:40 -06:00
|
|
|
#[allow(deprecated)]
|
2014-11-25 15:28:35 -06:00
|
|
|
pub use self::c_str::c_str_to_bytes;
|
2015-02-18 00:47:40 -06:00
|
|
|
#[allow(deprecated)]
|
2014-11-25 15:28:35 -06:00
|
|
|
pub use self::c_str::c_str_to_bytes_with_nul;
|
|
|
|
|
2015-03-02 12:46:05 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2015-01-21 17:55:31 -06:00
|
|
|
pub use self::os_str::OsString;
|
2015-03-02 12:46:05 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2015-01-21 17:55:31 -06:00
|
|
|
pub use self::os_str::OsStr;
|
|
|
|
|
2014-11-25 15:28:35 -06:00
|
|
|
mod c_str;
|
2015-01-21 17:55:31 -06:00
|
|
|
mod os_str;
|
2015-01-27 14:20:58 -06:00
|
|
|
|
2015-01-29 16:33:11 -06:00
|
|
|
// FIXME (#21670): these should be defined in the os_str module
|
2015-01-27 14:20:58 -06:00
|
|
|
/// Freely convertible to an `&OsStr` slice.
|
2015-03-02 12:46:05 -06:00
|
|
|
#[unstable(feature = "std_misc")]
|
2015-01-27 14:20:58 -06:00
|
|
|
pub trait AsOsStr {
|
|
|
|
/// Convert to an `&OsStr` slice.
|
|
|
|
fn as_os_str(&self) -> &OsStr;
|
|
|
|
}
|