dope_sys/io/file/metadata.rs
1use crate::io::file::Kind;
2
3/// Native metadata for one opened or named file.
4#[derive(Clone, Copy, Debug)]
5#[repr(transparent)]
6pub struct Metadata(libc::stat);
7
8impl Metadata {
9 pub(super) const fn new(raw: libc::stat) -> Self {
10 Self(raw)
11 }
12
13 pub const fn kind(self) -> Kind {
14 Kind::from_mode(self.0.st_mode)
15 }
16
17 /// Exact signed st_size reported by the native metadata operation.
18 pub const fn size(self) -> i64 {
19 self.0.st_size
20 }
21}