MCPcopy Index your code
hub / github.com/ZeroIntensity/pointers.py / cast

Function cast

src/pointers/c_pointer.py:242–252  ·  view source on GitHub ↗

Cast a void pointer to a typed pointer.

(ptr: VoidPointer, data_type: Type[T])

Source from the content-addressed store, hash-verified

240
241@handle
242def cast(ptr: VoidPointer, data_type: Type[T]) -> TypedCPointer[T]:
243 """Cast a void pointer to a typed pointer."""
244
245 return TypedCPointer(
246 ptr.ensure(),
247 data_type,
248 ptr.size,
249 decref=False,
250 void_p=True,
251 alt=True,
252 )
253
254
255def to_voidp(ptr: TypedCPointer[Any]) -> VoidPointer:

Callers 1

_Function · 0.90

Calls 2

TypedCPointerClass · 0.85
ensureMethod · 0.45

Tested by 1

_Function · 0.72