Add a size()
function to WASI's MetadataExt
.
WASI's `filestat` type includes a size field, so expose it in `MetadataExt` via a `size()` function, similar to the corresponding Unix function.
This commit is contained in:
parent
178108bf81
commit
e8dcc02dc5
1 changed files with 5 additions and 0 deletions
|
@ -397,6 +397,8 @@ pub trait MetadataExt {
|
||||||
fn ino(&self) -> u64;
|
fn ino(&self) -> u64;
|
||||||
/// Returns the `st_nlink` field of the internal `filestat_t`
|
/// Returns the `st_nlink` field of the internal `filestat_t`
|
||||||
fn nlink(&self) -> u64;
|
fn nlink(&self) -> u64;
|
||||||
|
/// Returns the `st_size` field of the internal `filestat_t`
|
||||||
|
fn size(&self) -> u64;
|
||||||
/// Returns the `st_atim` field of the internal `filestat_t`
|
/// Returns the `st_atim` field of the internal `filestat_t`
|
||||||
fn atim(&self) -> u64;
|
fn atim(&self) -> u64;
|
||||||
/// Returns the `st_mtim` field of the internal `filestat_t`
|
/// Returns the `st_mtim` field of the internal `filestat_t`
|
||||||
|
@ -415,6 +417,9 @@ impl MetadataExt for fs::Metadata {
|
||||||
fn nlink(&self) -> u64 {
|
fn nlink(&self) -> u64 {
|
||||||
self.as_inner().as_wasi().nlink
|
self.as_inner().as_wasi().nlink
|
||||||
}
|
}
|
||||||
|
fn size(&self) -> u64 {
|
||||||
|
self.as_inner().as_wasi().size
|
||||||
|
}
|
||||||
fn atim(&self) -> u64 {
|
fn atim(&self) -> u64 {
|
||||||
self.as_inner().as_wasi().atim
|
self.as_inner().as_wasi().atim
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue