Skip to content

channel: Provide and use Sink::prepare_send_from

Ian Jackson requested to merge Diziet/arti:channel into main

From the principal commit message:

This is a general-purpose implementation of the ad-hoc approach
currently taken in (eg) crates/tor-proto/src/channel/reactor.rs,
with an API intended to defned against the more obvious mistakes.

This allows us to separate the two concerns: the channel reactor can
focus on handling channel cells and control messages and is over 2.5x
shorter.

The complexity of the manual sink implementation, and the machinery
needed to avoid having to suspend while holding an item, are dealt
with separately.  That separate implemenation now has proper
documentation. [...]

We use `extend` to define this as an extension trait.  A competitor is
`ext` but in my personal projects I have found `extend` slightly
better.

I'm not sure if this is OK in tor-basic-utils. I think right now we don't have our own futures utils, other than tor-rtcompat which seems a much worse place.

Edited by Ian Jackson

Merge request reports