Expand description
Helper utilities for the Hydroflow surface syntax.
Modules§
- Module for the
Clear
trait. - Traits for the
demux_enum
derive and operator. - Module for
MonotonicMap
. - A multiset backed by a HashMap
- A vector that supports efficient deletion without reordering all subsequent items.
- Unsync (i.e. single-threaded) synchronization primitives.
Structs§
- When a
Child
is dropped normally nothing happens but in unit tests you usually want to terminate the child and wait for it to terminate.DroppableChild
does that for us. - A wrapper christening a closure as a monotonic function
- A wrapper christening a closure as a lattice morphism
Enums§
- Persit or delete tuples
- Persit or delete key-value pairs
Functions§
- Create a listening tcp socket, and then as new connections come in, receive their data and forward it to a queue.
- Returns a newline-delimited bytes
Sender
,Receiver
, andSocketAddr
bound to the given address. The inputaddr
may have a port of0
, the returnedSocketAddr
will be the address of the newly bound endpoint. The inbound connections can be used in full duplex mode. When a(T, SocketAddr)
pair is fed to theSender
returned by this function, theSocketAddr
will be looked up against the currently existing connections. If a match is found then the data will be sent on that connection. If no match is found then the data is silently dropped. - This is the same thing as
bind_tcp_bytes
except instead of using a length-delimited encoding scheme it uses new lines to separate frames. - Returns a length-delimited bytes
Sink
,Stream
, andSocketAddr
bound to the given address. The inputaddr
may have a port of0
, the returnedSocketAddr
will have the chosen port. - Returns a newline-delimited bytes
Sink
,Stream
, andSocketAddr
bound to the given address. The inputaddr
may have a port of0
, the returnedSocketAddr
will have the chosen port. - Collects the immediately available items from the
Stream
into aFromIterator
collection. - Collects the immediately available items from the
Stream
into a collection (Default
+Extend
). - This is the inverse of bind_tcp, when messages enqueued into the returned sender, tcp sockets will be created and connected as necessary to send out the requests. As the responses come back, they will be forwarded to the returned receiver.
- This is inverse of bind_tcp_bytes.
(Bytes, SocketAddr)
pairs fed to the returnedSender
will initiate new tcp connections to the specifiedSocketAddr
. These connections will be cached and reused, so that there will only be one connection per destination endpoint. When the endpoint sends data back it will be available via the returnedReceiver
- This is the same thing as
connect_tcp_bytes
except instead of using a length-delimited encoding scheme it uses new lines to separate frames. - Serialize a message from bytes using bincode.
- Resolve the
ipv4
SocketAddr
from an IP or hostname string. - Returns an [
Stream
] that emitsn
items at a time fromiter
at a time, yielding in-between. This is useful for breaking up a large iterator across several ticks:source_iter(...)
always releases all items in the first tick. However usingiter_batches_stream
withsource_stream(...)
will causen
items to be released each tick. (Although more than that may be emitted if there are loops in the stratum). - Returns an
Iterator
of any immediately available items from the [Stream
]. - rust examples are meant to be run by people and have a natural interface for that. This makes unit testing them cumbersome. This function wraps calling cargo run and piping the stdin/stdout of the example to easy to handle returned objects. The function also returns a
DroppableChild
which will ensure that the child processes will be cleaned up appropriately. - Serialize a message to bytes using bincode.
- Sort a slice using a key fn which returns references.
- Helper creates a TCP
Stream
andSink
forBytes
strings where each string is length-delimited. - Helper creates a TCP
Stream
andSink
for undelimited streams ofBytes
. - Helper creates a TCP
Stream
andSink
from the given socket, using the givenCodec
to handle delineation between inputs/outputs. - Helper creates a TCP
Stream
andSink
forstr
ings delimited by newlines. - Helper creates a UDP
Stream
andSink
forBytes
strings where each string is length-delimited. - Helper creates a UDP
Stream
andSink
for undelimited streams ofBytes
. - Helper creates a UDP
Stream
andSink
from the given socket, using the givenCodec
to handle delineation between inputs/outputs. Also returns the bound UdpSocket, which will be different than the input UdpSocket if the input socket was set to port 0. - Helper creates a UDP
Stream
andSink
forString
s delimited by newlines. - Returns a channel as a (1) unbounded sender and (2) unbounded receiver
Stream
for use in Hydroflow. - Helper creates a Unix
Stream
andSink
forBytes
strings where each string is length-delimited. - Helper creates a Unix
Stream
andSink
for undelimited streams ofBytes
. - Helper creates a Unix
Stream
andSink
from the given socket, using the givenCodec
to handle delineation between inputs/outputs. - Helper creates a Unix
Stream
andSink
forstr
ings delimited by newlines. - Returns an unsync channel as a (1) sender and (2) receiver
Stream
for use in Hydroflow. - When a child process is spawned often you want to wait until the child process is ready before moving on. One way to do that synchronization is by waiting for the child process to output something and match regex against that output. For example, you could wait until the child process outputs “Client live!” which would indicate that it is ready to receive input now on stdin.
Type Aliases§
- A framed TCP
Sink
(sending). - A framed TCP
Stream
(receiving). - A UDP undelimited bytes
Sink
(sending). - A UDP undelimited bytes
Stream
(receiving). - A framed UDP
Sink
(sending). - A framed UDP
Stream
(receiving). - A UDP newline-delimited
String
Sink
(sending). - A UDP newline-delimited
String
Stream
(receivng). - A UDP length-delimited frame
Sink
(sending). - A UDP length-delimited frame
Stream
(receiving).