#![no_std]
#![cfg_attr(target_os = "none", feature(pattern))]
#![cfg_attr(target_os = "none", feature(negative_impls))]
#![cfg_attr(target_os = "none", feature(alloc_io))]
#![cfg_attr(target_os = "none", feature(core_io))]
#![cfg_attr(target_os = "none", feature(io_error_uncategorized))]
#![cfg_attr(target_os = "none", feature(io_error_input_output_error))]
#![cfg_attr(target_os = "none", feature(io_error_more))]
#![cfg_attr(target_os = "none", feature(io_error_too_many_open_files))]
extern crate alloc;
#[cfg(not(target_os = "none"))]
extern crate std;
#[cfg(target_os = "none")]
pub mod fs;
#[cfg(target_os = "none")]
pub mod io;
#[cfg(target_os = "none")]
pub mod process;
#[cfg(target_os = "none")]
pub mod thread;
#[cfg(target_os = "none")]
pub mod os;
#[cfg(target_os = "none")]
pub mod sync;
#[cfg(target_os = "none")]
pub mod env;
#[cfg(target_os = "none")]
pub mod time;
#[cfg(target_os = "none")]
pub mod path;
#[cfg(target_os = "none")]
pub mod ffi;
#[cfg(target_os = "none")]
mod macros;
#[cfg(target_os = "none")]
mod panic;
#[cfg(target_os = "none")]
mod allocator;
#[cfg(target_os = "none")]
pub(crate) mod pagevec;
#[cfg(target_os = "none")]
pub mod start;
#[cfg(not(target_os = "none"))]
mod start;
use core::mem::MaybeUninit;
use core::ptr::slice_from_raw_parts_mut;
#[cfg(not(target_os = "none"))]
pub use std::fs;
#[cfg(not(target_os = "none"))]
pub use std::io;
#[cfg(not(target_os = "none"))]
pub use std::process;
#[cfg(not(target_os = "none"))]
pub use std::thread;
#[cfg(not(target_os = "none"))]
pub use std::os;
#[cfg(not(target_os = "none"))]
pub use std::sync;
#[cfg(not(target_os = "none"))]
pub use std::env;
#[cfg(not(target_os = "none"))]
pub use std::time;
#[cfg(not(target_os = "none"))]
pub use std::path;
#[cfg(not(target_os = "none"))]
pub use std::ffi;
#[cfg(not(target_os = "none"))]
pub use std::{print, println, eprintln, eprint};
use crate::fs::File;
fn read_value<T>(file: &mut File) -> Result<T, io::Error> {
use alloc::vec;
use crate::io::Read;
let mut bytes = vec![0; size_of::<T>()];
file.read_exact(&mut bytes)?;
unsafe {
let mut value: MaybeUninit<T> = MaybeUninit::uninit();
let slice = slice_from_raw_parts_mut(&mut value as *mut MaybeUninit<T> as *mut u8, size_of::<T>()).as_mut_unchecked();
slice.copy_from_slice(bytes.as_slice());
Ok(value.assume_init())
}
}