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