Module hydroflow::util

source ·
Expand description

Helper utilities for the Hydroflow surface syntax.

Modules§

Structs§

Enums§

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, and SocketAddr bound to the given address. The input addr may have a port of 0, the returned SocketAddr 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 the Sender returned by this function, the SocketAddr 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, and SocketAddr bound to the given address. The input addr may have a port of 0, the returned SocketAddr will have the chosen port.
  • Returns a newline-delimited bytes Sink, Stream, and SocketAddr bound to the given address. The input addr may have a port of 0, the returned SocketAddr will have the chosen port.
  • Collects the immediately available items from the Stream into a FromIterator 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 returned Sender will initiate new tcp connections to the specified SocketAddr. 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 returned Receiver
  • 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 emits n items at a time from iter 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 using iter_batches_stream with source_stream(...) will cause n 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 and Sink for Bytes strings where each string is length-delimited.
  • Helper creates a TCP Stream and Sink for undelimited streams of Bytes.
  • Helper creates a TCP Stream and Sink from the given socket, using the given Codec to handle delineation between inputs/outputs.
  • Helper creates a TCP Stream and Sink for strings delimited by newlines.
  • Helper creates a UDP Stream and Sink for Bytes strings where each string is length-delimited.
  • Helper creates a UDP Stream and Sink for undelimited streams of Bytes.
  • Helper creates a UDP Stream and Sink from the given socket, using the given Codec 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 and Sink for Strings 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 and Sink for Bytes strings where each string is length-delimited.
  • Helper creates a Unix Stream and Sink for undelimited streams of Bytes.
  • Helper creates a Unix Stream and Sink from the given socket, using the given Codec to handle delineation between inputs/outputs.
  • Helper creates a Unix Stream and Sink for strings 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§