We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2698a33 commit eb8c986Copy full SHA for eb8c986
src/v8.zig
@@ -951,6 +951,15 @@ pub fn Persistent(comptime T: type) type {
951
};
952
}
953
954
+ /// recoverCast is not meant to create a new Persistent, but instead to recover one for which we know that it is a Persistent.
955
+ /// This can be used on an object that has previously been `castTo___`. This allows the user to store and operate on the
956
+ /// underlying type without needing to extract it from the Persistent. Casting it back to Persistent allows us to reset it.
957
+ pub fn recoverCast(data: T) Self {
958
+ return .{
959
+ .handle = @as(handleT, @ptrCast(data.handle)),
960
+ };
961
+ }
962
+
963
pub fn toValue(self: Self) Value {
964
return .{
965
.handle = self.handle,
0 commit comments