Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/csp/chan.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,16 @@ func Text[T ~string](t T) Value {
// Future result from a Chan operation. It is a specialized instance
// of a casm.Future that provides typed methods for common capnp.Ptr
// types.
type Future casm.Future
type Future struct{ casm.Future }

// Value returns a *Future that asynchronously resolves to the next
// value produced by the channel.
func (f Future) Value() *capnp.Future {
return f.Field(0, nil)
}

func (f Future) Client() capnp.Client {
<-f.Done() // avoids returning *promised* client
return f.Value().Client()
}

Expand Down