Feature: Make streams implement the existing Go io interfaces.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start by locating the generated StreamReader and StreamWriter types for stream and read their existing stream operations. Check how those types currently handle reading, writing, and closing, then verify that they satisfy the io.Reader, io.Writer, io.ReadCloser, and io.WriteCloser interfaces and can be passed to the JSON encoder shown in the issue.
Written by the indexing model from the issue text.
Description
Description
In order to make bindings more Go idiomatic we should make streams implement the io.Reader, io.Writer and io.Closer interfaces. This would enable more seamless integration with existing Go functions.
Example
For the following wit type stream<u8> the types should implement the following:
// StreamReader implements io.ReadCloser
var _ io.ReadCloser = (*witTypes.StreamReader[uint8])(nil)
// io.ReadCloser
type ReadCloser interface {
Read(p []byte) (n int, err error)
Close() error
}
// StreamWriter implements io.WriteCloser
var _ io.WriteCloser = (*witTypes.StreamWriter[uint8])(nil)
// io.WriteCloser
type WriteCloser interface {
Write(p []byte) (n int, err error)
Close() error
}
This would allow you to for example, encode json straight onto the stream:
// Create stream
tx, rx := foo.MakeStreamU8()
// Encode json
err := son.NewEncoder(tx).Encode(map[string]string{
"foo": "bar",
})
...
- Dominant language
- Go
- Stars
- 0
- Forks
- 6
- Avg merge
- 1h
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bytecodealliance/go-pkg
-
Bootstrap `go-pkg`May be free again @asteurer claimed this 238 days ago, and no pull request is open. Open
bytecodealliance/go-pkg#1 · 1 assignee ·
All issues in bytecodealliance/go-pkg
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[E2E Scenario Tests] HTTP logs capture export requests from test framework, polluting golden filesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
GoogleCloudPlatform/k8s-config-connector#13675 ·
Maintainers usually reply within 1 day
-
ai-inspected
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day