You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// The fastest way to create string names is using [`static_name!`][crate::builtin::static_name], which creates a static cached `StringName` from null-terminated C-string literals such as `c"MyClass"`. These can be used directly by Godot without conversion. The encoding is limited to Latin-1, however. See the corresponding
// StringName expects that the destructor is not invoked on static instances (or only at global exit; see SNAME(..) macro in Godot).
391
-
// According to testing with godot4 --verbose, there is no mention of "Orphan StringName" at shutdown when incrementing the ref-count,
392
-
// so this should not leak memory.
393
-
result.inc_ref();
394
-
result
382
+
}
395
383
}
396
384
}
397
385
@@ -500,3 +488,30 @@ mod serialize {
500
488
}
501
489
}
502
490
}
491
+
492
+
/// Creates and gets a reference to a static `StringName` from a ASCII/Latin-1 `c"string"`.
493
+
///
494
+
/// This is the fastest way to create a StringName repeatedly, with the result being cached and never released, like `SNAME` in Godot source code. Suitable for scenarios where high performance is required.
0 commit comments