class
Movie::Remote::FrameCodec::Encoder
- Movie::Remote::FrameCodec::Encoder
- Reference
- Object
Overview
Stateful encoder with a reusable JSON buffer. It is not thread-safe and must be owned by one caller (normally a connection's outbound writer).
Defined in:
movie/remote/frame_codec.crConstructors
Instance Method Summary
-
#append(envelope : WireEnvelope, io : IO) : Nil
Appends one complete length-prefixed frame without flushing the target.
- #encode(envelope : WireEnvelope, io : IO) : Nil
-
#with_frame(envelope : WireEnvelope, & : Bytes -> ) : Nil
Yields a complete frame from the reusable encoder buffer.
Constructor Detail
Instance Method Detail
def append(envelope : WireEnvelope, io : IO) : Nil
#
Appends one complete length-prefixed frame without flushing the target. This lets a connection writer concatenate ready frames into one write.
def with_frame(envelope : WireEnvelope, & : Bytes -> ) : Nil
#
Yields a complete frame from the reusable encoder buffer. The slice is only valid for the duration of the block.