|
1 | 1 | //! User and Group ID types.
|
2 | 2 |
|
| 3 | +use core::fmt; |
| 4 | + |
3 | 5 | use crate::backend::c;
|
4 | 6 | use crate::ffi;
|
5 | 7 |
|
@@ -86,6 +88,78 @@ impl Gid {
|
86 | 88 | }
|
87 | 89 | }
|
88 | 90 |
|
| 91 | +impl fmt::Display for Uid { |
| 92 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 93 | + self.0.fmt(f) |
| 94 | + } |
| 95 | +} |
| 96 | +impl fmt::Binary for Uid { |
| 97 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 98 | + self.0.fmt(f) |
| 99 | + } |
| 100 | +} |
| 101 | +impl fmt::Octal for Uid { |
| 102 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 103 | + self.0.fmt(f) |
| 104 | + } |
| 105 | +} |
| 106 | +impl fmt::LowerHex for Uid { |
| 107 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 108 | + self.0.fmt(f) |
| 109 | + } |
| 110 | +} |
| 111 | +impl fmt::UpperHex for Uid { |
| 112 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 113 | + self.0.fmt(f) |
| 114 | + } |
| 115 | +} |
| 116 | +impl fmt::LowerExp for Uid { |
| 117 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 118 | + self.0.fmt(f) |
| 119 | + } |
| 120 | +} |
| 121 | +impl fmt::UpperExp for Uid { |
| 122 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 123 | + self.0.fmt(f) |
| 124 | + } |
| 125 | +} |
| 126 | + |
| 127 | +impl fmt::Display for Gid { |
| 128 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 129 | + self.0.fmt(f) |
| 130 | + } |
| 131 | +} |
| 132 | +impl fmt::Binary for Gid { |
| 133 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 134 | + self.0.fmt(f) |
| 135 | + } |
| 136 | +} |
| 137 | +impl fmt::Octal for Gid { |
| 138 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 139 | + self.0.fmt(f) |
| 140 | + } |
| 141 | +} |
| 142 | +impl fmt::LowerHex for Gid { |
| 143 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 144 | + self.0.fmt(f) |
| 145 | + } |
| 146 | +} |
| 147 | +impl fmt::UpperHex for Gid { |
| 148 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 149 | + self.0.fmt(f) |
| 150 | + } |
| 151 | +} |
| 152 | +impl fmt::LowerExp for Gid { |
| 153 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 154 | + self.0.fmt(f) |
| 155 | + } |
| 156 | +} |
| 157 | +impl fmt::UpperExp for Gid { |
| 158 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 159 | + self.0.fmt(f) |
| 160 | + } |
| 161 | +} |
| 162 | + |
89 | 163 | // Return the raw value of the IDs. In case of `None` it returns `!0` since it
|
90 | 164 | // has the same bit pattern as `-1` indicating no change to the owner/group ID.
|
91 | 165 | pub(crate) fn translate_fchown_args(
|
|
0 commit comments