struct Novika::Byteslice
- Novika::Byteslice
- Struct
- Value
- Object
Included Modules
Defined in:
novika/forms/byteslice.crConstant Summary
-
DEFAULT_PREVIEW =
"byteslice"
-
Holds the default preview string for byteslices.
Constructors
-
.new(bytes : Bytes, preview : String = DEFAULT_PREVIEW, mutable : Bool = true)
Initializes a byteslice from bytes.
-
.new(io : IO, preview = DEFAULT_PREVIEW, mutable = true)
Initializes a byteslice form from the given io.
-
.new(&)
Yields an IO to the block, then returns a raw bytes form for it.
Class Method Summary
Instance Method Summary
-
#==(other : self)
Two byteslices are equal when their content is equal, and their mutability statuses are equal.
-
#address
Returns the memory address where this byteslice points to.
-
#at(b : Int32, e : Int32)
Returns a sub-slice starting at b-th byte, and ending at e-th byte.
-
#at(index : Int32)
Returns the index-th byte.
-
#count
Returns the amount of bytes in this byteslice.
- #desc(io)
-
#hash(hasher)
Two byteslices are equal when their content is equal, and their mutability statuses are equal.
-
#mutable? : Bool
Returns whether this byteslice is mutable.
-
#points_to?(address : UInt64)
Returns whether this byteslice points to the given address.
-
#preview : String
Returns the preview string of this byteslice.
-
#same?(other : Byteslice)
Returns whether this and other byteslices point to the same location in memory, and have the same mutability status.
-
#to_io : IO::Memory
Wraps the underlying byte slice in an IO.
- #to_s(io)
-
#to_unsafe : Bytes
Returns the underlying byte slice.
-
#write_to(io : IO)
Writes this byteslice to io.
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
Initializes a byteslice from bytes.
Initializes a byteslice form from the given io.
Class Method Detail
Instance Method Detail
Two byteslices are equal when their content is equal, and their mutability statuses are equal.
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.
Two byteslices are equal when their content is equal, and their mutability statuses are equal.
Returns whether this and other byteslices point to the same location in memory, and have the same mutability status.