Commit 2311556
rust: Implement the smart pointer
For pinned and unpinned initialization of structs, a trait named
`InPlaceInit` exists for uniform access. `Arc` did not implement
`InPlaceInit` yet, although the functions already existed. The main
reason for that, was that the trait itself returned a `Pin<Self>`. The
`Arc` implementation of the kernel is already implicitly pinned.
To enable `Arc` to implement `InPlaceInit` and to have uniform access,
for in-place and pinned in-place initialization, an associated type is
introduced for `InPlaceInit`. The new implementation of `InPlaceInit`
for `Arc` sets `Arc` as the associated type. Older implementations use
an explicit `Pin<T>` as the associated type. The implemented methods for
`Arc` are mostly moved from a direct implementation on `Arc`. There
should be no user impact. The implementation for `ListArc` is omitted,
because it is not merged yet.
Link: Rust-for-Linux#1079
Signed-off-by: Alex Mantel <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Removed "Rusts" (Benno). - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>InPlaceInit for Arc
1 parent 7c626ce commit 2311556
2 files changed
+37
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
| |||
1107 | 1108 | | |
1108 | 1109 | | |
1109 | 1110 | | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
1110 | 1117 | | |
1111 | 1118 | | |
1112 | 1119 | | |
1113 | 1120 | | |
1114 | | - | |
| 1121 | + | |
1115 | 1122 | | |
1116 | 1123 | | |
1117 | 1124 | | |
1118 | 1125 | | |
1119 | 1126 | | |
1120 | 1127 | | |
1121 | 1128 | | |
1122 | | - | |
| 1129 | + | |
1123 | 1130 | | |
1124 | 1131 | | |
1125 | 1132 | | |
| |||
1148 | 1155 | | |
1149 | 1156 | | |
1150 | 1157 | | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1151 | 1178 | | |
| 1179 | + | |
| 1180 | + | |
1152 | 1181 | | |
1153 | | - | |
| 1182 | + | |
1154 | 1183 | | |
1155 | 1184 | | |
1156 | 1185 | | |
| |||
1179 | 1208 | | |
1180 | 1209 | | |
1181 | 1210 | | |
| 1211 | + | |
| 1212 | + | |
1182 | 1213 | | |
1183 | | - | |
| 1214 | + | |
1184 | 1215 | | |
1185 | 1216 | | |
1186 | 1217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 213 | | |
235 | 214 | | |
236 | 215 | | |
| |||
0 commit comments