struct

Pointer::Appender(T)

Inherits Struct / Value / Object

Unsafe wrapper around a Pointer that allows to write values to it while advancing the location and keeping track of how many elements were written.

See also: Pointer#appender.

Constructors

new(pointer : Pointer(T))
Source

Instance methods

<<(value : T)
Source
pointer
Source
size
Source
to_slice

Creates a slice pointing at the values appended by this instance.

slice = Slice(Int32).new(5)
appender = slice.to_unsafe.appender
appender << 1
appender << 2
appender << 3
appender.to_slice # => Slice[1, 2, 3]
Source