fixed no_std

This commit is contained in:
Dominik Maier 2021-03-04 19:32:41 +01:00
parent bb54d551ac
commit ef861cbbcf

View File

@ -6,11 +6,8 @@ use xxhash_rust::xxh3::xxh3_64_with_seed;
#[cfg(unix)]
use libc::pid_t;
#[cfg(unix)]
#[cfg(all(unix, feature = "std"))]
use std::ffi::CString;
use crate::Error;
#[cfg(feature = "std")]
use std::{
env,
@ -18,6 +15,9 @@ use std::{
time::{SystemTime, UNIX_EPOCH},
};
#[cfg(feature = "std")]
use crate::Error;
pub trait AsSlice<T> {
/// Convert to a slice
fn as_slice(&self) -> &[T];
@ -417,7 +417,7 @@ pub enum ForkResult {
/// Unix has forks.
/// # Safety
/// A Normal fork. Runs on in two processes. Should be memory safe in general.
#[cfg(unix)]
#[cfg(all(unix, feature = "std"))]
pub unsafe fn fork() -> Result<ForkResult, Error> {
match libc::fork() {
pid if pid > 0 => Ok(ForkResult::Parent(ChildHandle { pid })),