Skip to content

Conversation

@antiguru
Copy link
Member

@antiguru antiguru commented Jan 6, 2026

The type doesn't add much value besides offering a narrower interface to InputHandleCore than the type did previously. With this change, the public interface provided by the latter type matches InputSession, which eliminates the need for a proper type to encapsulate the InputSession.

Makes the InputHandleCore::next function private as we'd like all uses to consume all inputs, and removes a unused internal function to access the handle's pull counter.

The type doesn't add much value besides offering a narrower interface to
InputHandleCore than the type did previously. With this change, the public
interface provided by the latter type matches InputSession, which
eliminates the need for a proper type to encapsulate the InputSession.

Makes the `InputHandleCore::next` function private as we'd like all uses
to consume all inputs, and removes a unused internal function to access
the handle's pull counter.

Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
@frankmcsherry
Copy link
Member

So, had a read through the code (I didn't make it easy on us) and think the reason InputSession exists is to provide the #[must_use] decoration. I.e. it is a way to communicate "you need to call either for_each or for_each_time on this". Whether that is a valuable thing to insist on (it's almost surely a bug if you do not) in exchange for the noise around it is a diff question though. But I think that's why it exists.

Still pondering if this feature is worth it, though.

@antiguru
Copy link
Member Author

[T]he reason InputSession exists is to provide the #[must_use] decoration.

I don't think the #[must_use] works as expected. What it does is require all callers of functions returning an InputSession to consume the object. I think the only place to obtain the type is through InputHandleCore::activate, so the annotation on the type has the same effect as specifying #[must_use] on activate. It does not affect Rust's behavior around consuming arguments to closures, which are locally-bound variables, so the whole "unused variable" machinery protects against not using the input parameter here.

@frankmcsherry
Copy link
Member

Yeah, good point. I misunderstood what the attribute on a type means (rather than a function), but it seems to be the case. Linear types would do the right thing here, but this attribute does not do that.

@frankmcsherry
Copy link
Member

Seems good!

@frankmcsherry frankmcsherry merged commit 7d5c9c1 into TimelyDataflow:master Jan 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants