File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,25 @@ item_id_newtype! {
154
154
unchecked = as_var_id_unchecked;
155
155
}
156
156
157
+ item_id_newtype ! {
158
+ /// An identifier for an `Item` whose `ItemKind` is known to be
159
+ /// `ItemKind::Function`.
160
+ pub struct FunctionId ( ItemId )
161
+ where
162
+ /// Convert this `ItemId` into a `FunctionId` if its associated item is a function,
163
+ /// otherwise return `None`.
164
+ checked = as_function_id with is_function,
165
+
166
+ /// Convert this `ItemId` into a `FunctionId`.
167
+ ///
168
+ /// If this `ItemId` does not point to a function, then panic.
169
+ expected = expect_function_id,
170
+
171
+ /// Convert this `ItemId` into a `FunctionId` without actually checking whether
172
+ /// this id actually points to a `Function`.
173
+ unchecked = as_function_id_unchecked;
174
+ }
175
+
157
176
impl From < ItemId > for usize {
158
177
fn from ( id : ItemId ) -> usize {
159
178
id. 0
You can’t perform that action at this time.
0 commit comments