struct
UnsafeRawPointer
Inheritance |
Comparable, CustomDebugStringConvertible, CustomPlaygroundQuickLookable, CustomReflectable, Equatable, Hashable, Strideable
View Protocol Hierarchy →
|
---|---|
Import |
|
Initializers
Converts an UnsafeMutableRawPointer to an UnsafeRawPointer
.
Declaration
init
(
_
other
:
UnsafeMutableRawPointer
)
Creates an UnsafeRawPointer
from another UnsafeRawPointer
.
Declaration
init
(
_
other
:
UnsafeRawPointer
)
Convert other AutoreleasingUnsafeMutablePointer
.
Declaration
init
<
T
>
(
_
other
:
AutoreleasingUnsafeMutablePointer
<
T
>
)
Converts an UnsafeMutablePointer to an UnsafeRawPointer
.
Declaration
init
<
T
>
(
_
other
:
UnsafeMutablePointer
<
T
>
)
Converts an opaque pointer to an UnsafeRawPointer
.
Returns nil
if from
is nil
.
Declaration
init
?(
_
other
:
OpaquePointer
?)
Converts an UnsafeMutableRawPointer to an UnsafeRawPointer
.
Returns nil
if other
is nil
.
Declaration
init
?(
_
other
:
UnsafeMutableRawPointer
?)
Creates an UnsafeRawPointer
from another UnsafeRawPointer
.
Returns nil
if other
is nil
.
Declaration
init
?(
_
other
:
UnsafeRawPointer
?)
Convert other AutoreleasingUnsafeMutablePointer
.
Returns nil if other
is nil.
Declaration
init
?
<
T
>
(
_
other
:
AutoreleasingUnsafeMutablePointer
<
T
>
?)
Converts an UnsafeMutablePointer to an UnsafeRawPointer
.
Returns nil
if other
is nil
.
Declaration
init
?
<
T
>
(
_
other
:
UnsafeMutablePointer
<
T
>
?)
Converts an UnsafePointer to an UnsafeRawPointer
.
Returns nil
if other
is nil
.
Declaration
init
?
<
T
>
(
_
other
:
UnsafePointer
<
T
>
?)
Converts a pattern of bits to an UnsafeRawPointer
.
Returns nil
if bitPattern
is zero.
Declaration
init
?(
bitPattern
:
Int
)
Converts a pattern of bits to an UnsafeRawPointer
.
Returns nil
if bitPattern
is zero.
Declaration
init
?(
bitPattern
:
UInt
)
Instance Variables
The custom mirror for this instance.
If this type has value semantics, the mirror should be unaffected by subsequent mutations of the instance.
Declaration
var
customMirror
:
Mirror
{
get
}
A custom playground Quick Look for this instance.
If this type has value semantics, the PlaygroundQuickLook
instance
should be unaffected by subsequent mutations.
Declaration
var
customPlaygroundQuickLook
:
PlaygroundQuickLook
{
get
}
A textual representation of the pointer, suitable for debugging.
Declaration
var
debugDescription
:
String
{
get
}
The pointer's hash value.
The hash value is not guaranteed to be stable across different invocations of the same program. Do not persist the hash value across program runs.
Declaration
var
hashValue
:
Int
{
get
}
Instance Methods
Converts from an UnsafeRawPointer
to UnsafePointer<T> given that
the region of memory starting at self
is already bound to type T
.
Precondition: The memory is bound to 'T' starting at self
for some
unspecified capacity.
Warning: Accessing memory via the returned pointer is undefined if the
if the memory has not been bound to T
.
Declaration
func
assumingMemoryBound
<
T
>
(
to
:
T
.
Type
) -
>
UnsafePointer
<
T
>
Binds the allocated memory to type T
and returns an
UnsafePointer<T>
to the bound memory at self
.
Precondition: The memory is uninitialized.
Postcondition: The memory is bound to 'T' starting at self
continuing
through self
+ count
* MemoryLayout<T>.stride
Warning: A memory location may only be bound to one type at a time.
The behavior of accessing memory as type U
while it is bound to an
unrelated type T
is undefined.
Declaration
func
bindMemory
<
T
>
(
to
type
:
T
.
Type
,
capacity
count
:
Int
) -
>
UnsafePointer
<
T
>
Reads raw bytes from memory at self + offset
and constructs a
value of type T
.
Precondition: The underlying pointer plus offset
is properly
aligned for accessing T
.
Precondition: The memory is initialized to a value of some type, U
,
such that T
is layout compatible with U
.
Declaration
func
load
<
T
>
(
fromByteOffset
offset
:
Int
=
default
,
as
type
:
T
.
Type
) -
>
T
A raw pointer for accessing untyped data. This provides no automatic memory management, no type safety, and no alignment guarantees. This implements Strideable to provide a view of byte-addressable memory.