Framer
A few helper classes to resize iodata streams and iolists.
If you do not want to add another dependency, feel free to steal any of the functions. They aren't long.
The two main functions are:
resize_stream/2for resizing elements of an iodata streamresize/2for resizing elements of an iodata list
Examples
Resizing a iodata stream:
iex> stream = ["The brown", " fox", ["that ", "jumped"], " up."]
iex> Framer.resize_stream(stream, 5) |> Enum.to_list()
[["The b"], ["rown", " "], ["fox", "th"], ["at ", "ju"], ["mped", " "], ["up."]]Resizing an iolist:
iex> enum = ["Hello ", "World"]
iex> Framer.resize(enum, 4)
[["Hell"], ["o ", "Wo"], ["rld"]]Installation
If available in Hex, the package can be installed
by adding framer to your list of dependencies in mix.exs:
def deps do
[
{:framer, "~> 0.1.0"}
]
endCaution
I have not benchmarked any of those functions, nor tested heavily in a production environment. Please proceed with caution.
Contributing
Please submit a PR or open an issue if you come across a bug or hit performance bottlenecks.
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/framer.