struct Base58::PointerCollection

Overview

This is essentially a lightweight Slice. It exists only to provide an Enumerable interface to a Pointer. The jury is still out on whether there is any point to this versus just using Slice. I did some quick benchmarks to justify this, but there needs to be more due diligence.

To use this, you need to pass in a pointer, the size of the pointer, and optionally the starting position within the pointer. It is up to you to ensure that the size of the pointer is accurate. No other bounds checking will be done.

Included Modules

Defined in:

base58/pointer_collection.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pointer : Pointer(UInt8), size : Int32, position : Int32 = 0) #

Instance Method Detail

def each(&) #
Description copied from module Enumerable(UInt8)

Must yield this collection's elements to the block.


def pointer : Pointer(UInt8) #

def position : Int32 #

def size : Int32 #
Description copied from module Enumerable(UInt8)

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4