structured_io v1.5.0 StructuredIO.Behaviour behaviour View Source
Defines a behavioral contract that is satisfied by StructuredIO
.
Link to this section Summary
Callbacks
Returns a value that can be passed to Enum.into/2
or Enum.into/3
for
writing data to the specified structured_io
Returns a value that can be passed to functions such as Enum.map/2
for
reading data elements from the specified structured_io
, using the specified
StructuredIO
function
, and the specified left
and/or right
/operation
Gets the mode of the specified structured_io
Reads data from the specified structured_io
in the specified quantity, or
beginning with the specified binary value
Reads data from the specified structured_io
beginning with the specified
left
and ending with the occurrence of the specified right
that
corresponds to it, inclusive
Reads data from the specified structured_io
beginning with the specified
left
and ending with the first occurrence of the specified right
,
inclusive
Reads data from the specified structured_io
beginning with the specified
left
and ending with the occurrence of the specified right
that
corresponds to it, exclusive
Reads data from the specified structured_io
beginning with the specified
left
and ending with the first occurrence of the specified right
,
exclusive
Invokes the specified operation
, changing the state of the specified
structured_io
only if the operation
is successful. Success is indicated
when the operation
returns {:ok, term}
, in which case only the term
is
returned
Reads data from the specified structured_io
if and until the specified
right
is encountered, including right
Reads data from the specified structured_io
if and until the specified
right
is encountered, excluding right
Starts a StructuredIO
process without links (outside a supervision tree) with
the specified mode
and options
Starts a StructuredIO
process linked to the current process with the
specified mode
and options
Stops the specified structured_io
process
Writes the specified data
to the specified structured_io
Link to this section Callbacks
collect(structured_io :: GenServer.server()) :: StructuredIO.Collector.t()
Returns a value that can be passed to Enum.into/2
or Enum.into/3
for
writing data to the specified structured_io
.
enumerate_with( structured_io :: GenServer.server(), function :: :read_through | :read_to, right :: StructuredIO.right() ) :: StructuredIO.Enumerator.t()
enumerate_with( structured_io :: GenServer.server(), function :: :read_complex, operation :: StructuredIO.operation() ) :: StructuredIO.Enumerator.t()
enumerate_with( structured_io :: GenServer.server(), function :: :read_across | :read_across_ignoring_overlap | :read_between | :read_between_ignoring_overlap, left :: StructuredIO.left(), right :: StructuredIO.right() ) :: StructuredIO.Enumerator.t()
Returns a value that can be passed to functions such as Enum.map/2
for
reading data elements from the specified structured_io
, using the specified
StructuredIO
function
, and the specified left
and/or right
/operation
.
mode(structured_io :: GenServer.server()) :: StructuredIO.mode()
Gets the mode of the specified structured_io
.
read( structured_io :: GenServer.server(), count_or_match :: StructuredIO.count() | StructuredIO.match(), timeout :: timeout() ) :: StructuredIO.match() | StructuredIO.error()
Reads data from the specified structured_io
in the specified quantity, or
beginning with the specified binary value.
read_across( structured_io :: GenServer.server(), left :: StructuredIO.left(), right :: StructuredIO.right(), timeout :: timeout() ) :: StructuredIO.match() | StructuredIO.error()
Reads data from the specified structured_io
beginning with the specified
left
and ending with the occurrence of the specified right
that
corresponds to it, inclusive.
read_across_ignoring_overlap( structured_io :: GenServer.server(), left :: StructuredIO.left(), right :: StructuredIO.right(), timeout :: timeout() ) :: StructuredIO.match() | StructuredIO.error()
Reads data from the specified structured_io
beginning with the specified
left
and ending with the first occurrence of the specified right
,
inclusive.
read_between( structured_io :: GenServer.server(), left :: StructuredIO.left(), right :: StructuredIO.right(), timeout :: timeout() ) :: StructuredIO.match() | StructuredIO.error()
Reads data from the specified structured_io
beginning with the specified
left
and ending with the occurrence of the specified right
that
corresponds to it, exclusive.
read_between_ignoring_overlap( structured_io :: GenServer.server(), left :: StructuredIO.left(), right :: StructuredIO.right(), timeout :: timeout() ) :: StructuredIO.match() | StructuredIO.error()
Reads data from the specified structured_io
beginning with the specified
left
and ending with the first occurrence of the specified right
,
exclusive.
read_complex( structured_io :: GenServer.server(), operation :: StructuredIO.operation(), timeout :: timeout() ) :: any()
Invokes the specified operation
, changing the state of the specified
structured_io
only if the operation
is successful. Success is indicated
when the operation
returns {:ok, term}
, in which case only the term
is
returned.
read_through( structured_io :: GenServer.server(), right :: StructuredIO.right(), timeout :: timeout() ) :: StructuredIO.match() | StructuredIO.error()
Reads data from the specified structured_io
if and until the specified
right
is encountered, including right
.
read_to( structured_io :: GenServer.server(), right :: StructuredIO.right(), timeout :: timeout() ) :: StructuredIO.match() | StructuredIO.error()
Reads data from the specified structured_io
if and until the specified
right
is encountered, excluding right
.
start(mode :: StructuredIO.mode(), options :: GenServer.options()) :: GenServer.on_start()
Starts a StructuredIO
process without links (outside a supervision tree) with
the specified mode
and options
.
start_link(mode :: StructuredIO.mode(), options :: GenServer.options()) :: GenServer.on_start()
Starts a StructuredIO
process linked to the current process with the
specified mode
and options
.
stop( structured_io :: GenServer.server(), reason :: term(), timeout :: timeout() ) :: :ok
Stops the specified structured_io
process.
write( structured_io :: GenServer.server(), data :: iodata() | IO.chardata() | String.Chars.t() ) :: :ok | StructuredIO.error()
Writes the specified data
to the specified structured_io
.