struct Novika::Byteslice

Included Modules

Defined in:

novika/forms/byteslice.cr

Constant Summary

DEFAULT_PREVIEW = "byteslice"

Holds the default preview string for byteslices.

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Novika::Form

a(type : T.class) : T forall T a, desc(io : IO)
desc : String
desc
, die(details : String) die, effect(io)
effect
effect
, on_open(engine : Engine) : self on_open, on_parent_open(engine : Engine) : self on_parent_open, onto(block : Block) : self onto, sel(a, b) sel, to_quote : Quote to_quote

Instance methods inherited from module Novika::Schedulable

schedule(engine : Engine, stack : Block) schedule, schedule!(engine : Engine, stack : Block) schedule!

Constructor Detail

def self.new(bytes : Bytes, preview : String = DEFAULT_PREVIEW, mutable : Bool = true) #

Initializes a byteslice from bytes.


[View source]
def self.new(io : IO, preview = DEFAULT_PREVIEW, mutable = true) #

Initializes a byteslice form from the given io.


[View source]
def self.new(&) #

Yields an IO to the block, then returns a raw bytes form for it.


[View source]

Class Method Detail

def self.typedesc #

[View source]

Instance Method Detail

def ==(other : self) #

Two byteslices are equal when their content is equal, and their mutability statuses are equal.


def address #

Returns the memory address where this byteslice points to.


[View source]
def at(b : Int32, e : Int32) #

Returns a sub-slice starting at b-th byte, and ending at e-th byte.

The resulting byteslice does not preserve the preview string of this byteslice.


[View source]
def at(index : Int32) #

Returns the index-th byte.


[View source]
def count #

Returns the amount of bytes in this byteslice.


[View source]
def desc(io) #

[View source]
def hash(hasher) #

Two byteslices are equal when their content is equal, and their mutability statuses are equal.


def mutable? : Bool #

Returns whether this byteslice is mutable.


[View source]
def points_to?(address : UInt64) #

Returns whether this byteslice points to the given address.


[View source]
def preview : String #

Returns the preview string of this byteslice.


[View source]
def same?(other : Byteslice) #

Returns whether this and other byteslices point to the same location in memory, and have the same mutability status.


[View source]
def to_io : IO::Memory #

Wraps the underlying byte slice in an IO.


[View source]
def to_s(io) #

[View source]
def to_unsafe : Bytes #

Returns the underlying byte slice.


[View source]
def write_to(io : IO) #

Writes this byteslice to io.


[View source]