This commit merges [CraneStation/wasi-common] repo as a subdir of this repo while preserving **all** of git history. There is an initiative to pull `wasi-common` into [CraneStation/wasmtime], and [CraneStation/wasmtime] becoming a monorepo. This came about for several reasons with a common theme of convenience, namely, having a monorepo: 1. cleans up the problem of dependencies (as we have seen first hand with dependabot enabled, it can cause some grief) 2. completely removes the problem of syncing the closely dependent repos (e.g., updating `wasi-common` with say a bugfix generally implies creating a "sync" commit for pulling in the changes into the "parent" repo, in this case, `wasmtime`) 3. mainly for the two reasons above, makes publishing to crates.io easier 4. hopefully streamlines the process of getting the community involved in contributing to `wasi-common` as now everything is one place [CraneStation/wasi-common]: https://github.com/CraneStation/wasi-common [CraneStation/wasmtime]: https://github.com/CraneStation/wasmtime
107 lines
3.4 KiB
Rust
107 lines
3.4 KiB
Rust
use crate::fs::{FileType, Permissions};
|
|
use std::{io, time::SystemTime};
|
|
|
|
/// Metadata information about a file.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html
|
|
#[derive(Clone)]
|
|
pub struct Metadata {}
|
|
|
|
impl Metadata {
|
|
/// Returns the file type for this metadata.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata::file_type`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata::file_type`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.file_type
|
|
pub fn file_type(&self) -> FileType {
|
|
unimplemented!("Metadata::file_type");
|
|
}
|
|
|
|
/// Returns true if this metadata is for a directory.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata::is_dir`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata::is_dir`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.is_dir
|
|
pub fn is_dir(&self) -> bool {
|
|
unimplemented!("Metadata::is_dir");
|
|
}
|
|
|
|
/// Returns true if this metadata is for a regular file.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata::is_file`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata::is_file`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.is_file
|
|
pub fn is_file(&self) -> bool {
|
|
unimplemented!("Metadata::is_file");
|
|
}
|
|
|
|
/// Returns the size of the file, in bytes, this metadata is for.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata::len`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata::len`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.len
|
|
pub fn len(&self) -> u64 {
|
|
unimplemented!("Metadata::len");
|
|
}
|
|
|
|
/// Returns the permissions of the file this metadata is for.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata::permissions`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata::permissions`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.permissions
|
|
pub fn permissions(&self) -> Permissions {
|
|
unimplemented!("Metadata::permissions");
|
|
}
|
|
|
|
/// Returns the last modification time listed in this metadata.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata::modified`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata::modified`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.modified
|
|
pub fn modified(&self) -> io::Result<SystemTime> {
|
|
unimplemented!("Metadata::modified");
|
|
}
|
|
|
|
/// Returns the last access time of this metadata.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata::accessed`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata::accessed`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.accessed
|
|
pub fn accessed(&self) -> io::Result<SystemTime> {
|
|
unimplemented!("Metadata::accessed");
|
|
}
|
|
|
|
/// Returns the creation time listed in this metadata.
|
|
///
|
|
/// This corresponds to [`std::fs::Metadata::created`].
|
|
///
|
|
/// TODO: Not yet implemented.
|
|
///
|
|
/// [`std::fs::Metadata::created`]: https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.created
|
|
pub fn created(&self) -> io::Result<SystemTime> {
|
|
unimplemented!("Metadata::created");
|
|
}
|
|
}
|
|
|
|
// TODO: Functions from MetadataExt?
|
|
|
|
// TODO: impl Debug for Metadata
|