Change the result of Trans.SendWriter to a WriteCloser

This commit is contained in:
Sasha Koshka 2025-04-25 18:06:00 -04:00
parent 41f5cfefab
commit dd89245c34

View File

@ -44,10 +44,12 @@ type Trans interface {
// Send sends a message. This method is not safe for concurrent use. // Send sends a message. This method is not safe for concurrent use.
Send(method uint16, data []byte) error Send(method uint16, data []byte) error
// SendWriter sends data written to an [io.Writer]. Any writer // SendWriter sends data written to an [io.Writer]. The writer must be
// previously opened through this function will be discarded. This // closed after use. Closing the writer flushes any data that hasn't
// method is not safe for concurrent use, and neither is its result. // been written yet. Any writer previously opened through this function
SendWriter(method uint16) (io.Writer, error) // will be discarded. This method is not safe for concurrent use, and
// neither is its result.
SendWriter(method uint16) (io.WriteCloser, error)
// Receive receives a message. This method is not safe for concurrent // Receive receives a message. This method is not safe for concurrent
// use. // use.
Receive() (method uint16, data []byte, err error) Receive() (method uint16, data []byte, err error)