1 #![stable(feature = "metadata_ext", since = "1.1.0")]
5 use crate::fs
::Metadata
;
6 use crate::sys_common
::AsInner
;
9 use crate::os
::illumos
::raw
;
11 /// OS-specific extensions to [`fs::Metadata`].
13 /// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
14 #[stable(feature = "metadata_ext", since = "1.1.0")]
15 pub trait MetadataExt
{
16 /// Gain a reference to the underlying `stat` structure which contains
17 /// the raw information returned by the OS.
19 /// The contents of the returned `stat` are **not** consistent across
20 /// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
21 /// cross-Unix abstractions contained within the raw stat.
22 #[stable(feature = "metadata_ext", since = "1.1.0")]
25 reason
= "deprecated in favor of the accessor methods of this trait"
28 fn as_raw_stat(&self) -> &raw
::stat
;
30 #[stable(feature = "metadata_ext2", since = "1.8.0")]
31 fn st_dev(&self) -> u64;
32 #[stable(feature = "metadata_ext2", since = "1.8.0")]
33 fn st_ino(&self) -> u64;
34 #[stable(feature = "metadata_ext2", since = "1.8.0")]
35 fn st_mode(&self) -> u32;
36 #[stable(feature = "metadata_ext2", since = "1.8.0")]
37 fn st_nlink(&self) -> u64;
38 #[stable(feature = "metadata_ext2", since = "1.8.0")]
39 fn st_uid(&self) -> u32;
40 #[stable(feature = "metadata_ext2", since = "1.8.0")]
41 fn st_gid(&self) -> u32;
42 #[stable(feature = "metadata_ext2", since = "1.8.0")]
43 fn st_rdev(&self) -> u64;
44 #[stable(feature = "metadata_ext2", since = "1.8.0")]
45 fn st_size(&self) -> u64;
46 #[stable(feature = "metadata_ext2", since = "1.8.0")]
47 fn st_atime(&self) -> i64;
48 #[stable(feature = "metadata_ext2", since = "1.8.0")]
49 fn st_atime_nsec(&self) -> i64;
50 #[stable(feature = "metadata_ext2", since = "1.8.0")]
51 fn st_mtime(&self) -> i64;
52 #[stable(feature = "metadata_ext2", since = "1.8.0")]
53 fn st_mtime_nsec(&self) -> i64;
54 #[stable(feature = "metadata_ext2", since = "1.8.0")]
55 fn st_ctime(&self) -> i64;
56 #[stable(feature = "metadata_ext2", since = "1.8.0")]
57 fn st_ctime_nsec(&self) -> i64;
58 #[stable(feature = "metadata_ext2", since = "1.8.0")]
59 fn st_blksize(&self) -> u64;
60 #[stable(feature = "metadata_ext2", since = "1.8.0")]
61 fn st_blocks(&self) -> u64;
64 #[stable(feature = "metadata_ext", since = "1.1.0")]
65 impl MetadataExt
for Metadata
{
67 fn as_raw_stat(&self) -> &raw
::stat
{
68 unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
70 fn st_dev(&self) -> u64 {
71 self.as_inner().as_inner().st_dev
as u64
73 fn st_ino(&self) -> u64 {
74 self.as_inner().as_inner().st_ino
as u64
76 fn st_mode(&self) -> u32 {
77 self.as_inner().as_inner().st_mode
as u32
79 fn st_nlink(&self) -> u64 {
80 self.as_inner().as_inner().st_nlink
as u64
82 fn st_uid(&self) -> u32 {
83 self.as_inner().as_inner().st_uid
as u32
85 fn st_gid(&self) -> u32 {
86 self.as_inner().as_inner().st_gid
as u32
88 fn st_rdev(&self) -> u64 {
89 self.as_inner().as_inner().st_rdev
as u64
91 fn st_size(&self) -> u64 {
92 self.as_inner().as_inner().st_size
as u64
94 fn st_atime(&self) -> i64 {
95 self.as_inner().as_inner().st_atime
as i64
97 fn st_atime_nsec(&self) -> i64 {
98 self.as_inner().as_inner().st_atime_nsec
as i64
100 fn st_mtime(&self) -> i64 {
101 self.as_inner().as_inner().st_mtime
as i64
103 fn st_mtime_nsec(&self) -> i64 {
104 self.as_inner().as_inner().st_mtime_nsec
as i64
106 fn st_ctime(&self) -> i64 {
107 self.as_inner().as_inner().st_ctime
as i64
109 fn st_ctime_nsec(&self) -> i64 {
110 self.as_inner().as_inner().st_ctime_nsec
as i64
112 fn st_blksize(&self) -> u64 {
113 self.as_inner().as_inner().st_blksize
as u64
115 fn st_blocks(&self) -> u64 {
116 self.as_inner().as_inner().st_blocks
as u64