Skip to content

Commit e9177f2

Browse files
authored
Merge pull request #509 from kuruk-mm/fix/typed-array-comments
Fix comments with legacy `TypedArray` to `Array`
2 parents 860c7a0 + 2670cc3 commit e9177f2

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

godot-codegen/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ enum RustTy {
163163
/// `bool`, `Vector3i`
164164
BuiltinIdent(Ident),
165165

166-
/// `TypedArray<i32>`
166+
/// `Array<i32>`
167167
BuiltinArray(TokenStream),
168168

169169
/// C-style raw pointer to a `RustTy`.
170170
RawPointer { inner: Box<RustTy>, is_const: bool },
171171

172-
/// `TypedArray<Gd<PhysicsBody3D>>`
172+
/// `Array<Gd<PhysicsBody3D>>`
173173
EngineArray {
174174
tokens: TokenStream,
175175
#[allow(dead_code)] // only read in minimal config

godot-core/src/builtin/array.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ impl<T: GodotType> Array<T> {
215215

216216
#[doc(hidden)]
217217
pub fn as_inner(&self) -> inner::InnerArray {
218-
// SAFETY: The memory layout of `TypedArray<T>` does not depend on `T`.
218+
// SAFETY: The memory layout of `Array<T>` does not depend on `T`.
219219
inner::InnerArray::from_outer_typed(self)
220220
}
221221

222222
/// Changes the generic type on this array, without changing its contents. Needed for API
223223
/// functions that return a variant array even though we know its type, and for API functions
224224
/// that take a variant array even though we want to pass a typed one.
225225
///
226-
/// This is marked `unsafe` since it can be used to break the invariant that a `TypedArray<T>`
226+
/// This is marked `unsafe` since it can be used to break the invariant that a `Array<T>`
227227
/// always holds a Godot array whose runtime type is `T`.
228228
///
229229
/// # Safety
@@ -236,7 +236,7 @@ impl<T: GodotType> Array<T> {
236236
/// In the current implementation, both cases will produce a panic rather than undefined
237237
/// behavior, but this should not be relied upon.
238238
unsafe fn assume_type<U: GodotType>(self) -> Array<U> {
239-
// SAFETY: The memory layout of `TypedArray<T>` does not depend on `T`.
239+
// SAFETY: The memory layout of `Array<T>` does not depend on `T`.
240240
unsafe { std::mem::transmute(self) }
241241
}
242242
}
@@ -276,7 +276,7 @@ impl<T: GodotType> Array<T> {
276276
///
277277
/// If specified, `step` is the relative index between source elements. It can be negative,
278278
/// in which case `begin` must be higher than `end`. For example,
279-
/// `TypedArray::from(&[0, 1, 2, 3, 4, 5]).slice(5, 1, -2)` returns `[5, 3]`.
279+
/// `Array::from(&[0, 1, 2, 3, 4, 5]).slice(5, 1, -2)` returns `[5, 3]`.
280280
///
281281
/// Array elements are copied to the slice, but any reference types (such as `Array`,
282282
/// `Dictionary` and `Object`) will still refer to the same value. To create a deep copy, use
@@ -292,7 +292,7 @@ impl<T: GodotType> Array<T> {
292292
///
293293
/// If specified, `step` is the relative index between source elements. It can be negative,
294294
/// in which case `begin` must be higher than `end`. For example,
295-
/// `TypedArray::from(&[0, 1, 2, 3, 4, 5]).slice(5, 1, -2)` returns `[5, 3]`.
295+
/// `Array::from(&[0, 1, 2, 3, 4, 5]).slice(5, 1, -2)` returns `[5, 3]`.
296296
///
297297
/// All nested arrays and dictionaries are duplicated and will not be shared with the original
298298
/// array. Note that any `Object`-derived elements will still be shallow copied. To create a
@@ -576,7 +576,7 @@ impl<T: GodotType + ToGodot> Array<T> {
576576
let len = self.len();
577577
assert!(
578578
index <= len,
579-
"TypedArray insertion index {index} is out of bounds: length is {len}",
579+
"Array insertion index {index} is out of bounds: length is {len}",
580580
);
581581
self.as_inner().insert(to_i64(index), value.to_variant());
582582
}
@@ -604,9 +604,9 @@ impl<T: GodotType + ToGodot> Array<T> {
604604
// but `[NAN] == [NAN]` is `true`. If they decide to make all NaNs equal, we can implement `Eq` and
605605
// `Ord`; if they decide to make all NaNs unequal, we can remove this comment.
606606
//
607-
// impl<T> Eq for TypedArray<T> {}
607+
// impl<T> Eq for Array<T> {}
608608
//
609-
// impl<T> Ord for TypedArray<T> {
609+
// impl<T> Ord for Array<T> {
610610
// ...
611611
// }
612612

godot-core/src/builtin/variant/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl Variant {
174174
}
175175

176176
/// return a false only if the variant is `Variant::NIL`
177-
/// or an empty `TypedArray` or `Dictionary`.
177+
/// or an empty `Array` or `Dictionary`.
178178
pub fn booleanize(&self) -> bool {
179179
unsafe { interface_fn!(variant_booleanize)(self.var_sys()) != 0 }
180180
}

0 commit comments

Comments
 (0)