IOData.Slice (iodata v0.7.0)
A module for handling slices of IO data.
This module provides a way to work with slices of IO data, allowing you to wrap a portion of IO data and perform operations such as checking the size, splitting, and converting to binary or IO data.
Types
t/0
- The type representing a slice of IO data.
Functions
wrap/3
- Wraps a portion of IO data into a slice.
Examples
iex> slice = IOData.Slice.wrap("hello world", 0, 5)
%IOData.Slice{iodata: "hello world", start: 0, count: 5}
iex> IOData.at_least?(slice, 3)
true
iex> IOData.split(slice, 2)
{:ok, {%IOData.Slice{iodata: "hello world", start: 0, count: 2}, %IOData.Slice{iodata: "hello world", start: 2, count: 3}}}
iex> IOData.to_binary(slice)
{:ok, "hello"}
Summary
Functions
Wraps a portion of IO data into a slice.
Types
@type t() :: %IOData.Slice{ count: non_neg_integer() | nil, iodata: IOData.t(), start: non_neg_integer() }