]> git.proxmox.com Git - rustc.git/blob - library/std/src/os/illumos/fs.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / library / std / src / os / illumos / fs.rs
1 #![stable(feature = "metadata_ext", since = "1.1.0")]
2
3 use crate::fs::Metadata;
4 use crate::sys_common::AsInner;
5
6 #[allow(deprecated)]
7 use crate::os::illumos::raw;
8
9 /// OS-specific extensions to [`fs::Metadata`].
10 ///
11 /// [`fs::Metadata`]: crate::fs::Metadata
12 #[stable(feature = "metadata_ext", since = "1.1.0")]
13 pub trait MetadataExt {
14 /// Gain a reference to the underlying `stat` structure which contains
15 /// the raw information returned by the OS.
16 ///
17 /// The contents of the returned `stat` are **not** consistent across
18 /// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
19 /// cross-Unix abstractions contained within the raw stat.
20 #[stable(feature = "metadata_ext", since = "1.1.0")]
21 #[deprecated(
22 since = "1.8.0",
23 note = "deprecated in favor of the accessor methods of this trait"
24 )]
25 #[allow(deprecated)]
26 fn as_raw_stat(&self) -> &raw::stat;
27
28 #[stable(feature = "metadata_ext2", since = "1.8.0")]
29 fn st_dev(&self) -> u64;
30 #[stable(feature = "metadata_ext2", since = "1.8.0")]
31 fn st_ino(&self) -> u64;
32 #[stable(feature = "metadata_ext2", since = "1.8.0")]
33 fn st_mode(&self) -> u32;
34 #[stable(feature = "metadata_ext2", since = "1.8.0")]
35 fn st_nlink(&self) -> u64;
36 #[stable(feature = "metadata_ext2", since = "1.8.0")]
37 fn st_uid(&self) -> u32;
38 #[stable(feature = "metadata_ext2", since = "1.8.0")]
39 fn st_gid(&self) -> u32;
40 #[stable(feature = "metadata_ext2", since = "1.8.0")]
41 fn st_rdev(&self) -> u64;
42 #[stable(feature = "metadata_ext2", since = "1.8.0")]
43 fn st_size(&self) -> u64;
44 #[stable(feature = "metadata_ext2", since = "1.8.0")]
45 fn st_atime(&self) -> i64;
46 #[stable(feature = "metadata_ext2", since = "1.8.0")]
47 fn st_atime_nsec(&self) -> i64;
48 #[stable(feature = "metadata_ext2", since = "1.8.0")]
49 fn st_mtime(&self) -> i64;
50 #[stable(feature = "metadata_ext2", since = "1.8.0")]
51 fn st_mtime_nsec(&self) -> i64;
52 #[stable(feature = "metadata_ext2", since = "1.8.0")]
53 fn st_ctime(&self) -> i64;
54 #[stable(feature = "metadata_ext2", since = "1.8.0")]
55 fn st_ctime_nsec(&self) -> i64;
56 #[stable(feature = "metadata_ext2", since = "1.8.0")]
57 fn st_blksize(&self) -> u64;
58 #[stable(feature = "metadata_ext2", since = "1.8.0")]
59 fn st_blocks(&self) -> u64;
60 }
61
62 #[stable(feature = "metadata_ext", since = "1.1.0")]
63 impl MetadataExt for Metadata {
64 #[allow(deprecated)]
65 fn as_raw_stat(&self) -> &raw::stat {
66 unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
67 }
68 fn st_dev(&self) -> u64 {
69 self.as_inner().as_inner().st_dev as u64
70 }
71 fn st_ino(&self) -> u64 {
72 self.as_inner().as_inner().st_ino as u64
73 }
74 fn st_mode(&self) -> u32 {
75 self.as_inner().as_inner().st_mode as u32
76 }
77 fn st_nlink(&self) -> u64 {
78 self.as_inner().as_inner().st_nlink as u64
79 }
80 fn st_uid(&self) -> u32 {
81 self.as_inner().as_inner().st_uid as u32
82 }
83 fn st_gid(&self) -> u32 {
84 self.as_inner().as_inner().st_gid as u32
85 }
86 fn st_rdev(&self) -> u64 {
87 self.as_inner().as_inner().st_rdev as u64
88 }
89 fn st_size(&self) -> u64 {
90 self.as_inner().as_inner().st_size as u64
91 }
92 fn st_atime(&self) -> i64 {
93 self.as_inner().as_inner().st_atime as i64
94 }
95 fn st_atime_nsec(&self) -> i64 {
96 self.as_inner().as_inner().st_atime_nsec as i64
97 }
98 fn st_mtime(&self) -> i64 {
99 self.as_inner().as_inner().st_mtime as i64
100 }
101 fn st_mtime_nsec(&self) -> i64 {
102 self.as_inner().as_inner().st_mtime_nsec as i64
103 }
104 fn st_ctime(&self) -> i64 {
105 self.as_inner().as_inner().st_ctime as i64
106 }
107 fn st_ctime_nsec(&self) -> i64 {
108 self.as_inner().as_inner().st_ctime_nsec as i64
109 }
110 fn st_blksize(&self) -> u64 {
111 self.as_inner().as_inner().st_blksize as u64
112 }
113 fn st_blocks(&self) -> u64 {
114 self.as_inner().as_inner().st_blocks as u64
115 }
116 }