nicholassm / disruptor-rs

Low latency inter-thread communication library in Rust inspired by the LMAX Disruptor.
MIT License
618 stars 18 forks source link

Suggestion: make handle_events_with visible in docs #15

Closed bluss closed 1 month ago

bluss commented 1 month ago

The method handle_events_with is used in docs and there are some good examples, but we can't find the rustdoc for the method handle_events_with itself.

I think this is probably because types like SPBuilder are not documented. I know there is no perfect solution here (concrete types vs traits and the interface you want to document and expose), but if this was my library I think I would treat SPBuilder as necessarily public and that it would be visible in docs (because it's a type participating in a public function's signature).

Similar things might be going on with SingleProducerBarrier and many other types which are pub but not reachable in docs.

nicholassm commented 1 month ago

Hi bluss,

In order to get a type safe builder API, I had to implement many different structs and auxiliary functionality and I thought it would be more confusing than helpful to document and expose those. In generel, I agree that it would be ideal to document all public functions and structs. I'll see how it looks and what I can do.

Is it concretely the handle_events_with signature you would like to see? Or...?

Kind regards, Nicholas

bluss commented 1 month ago

Yes, it was specifically handle_events_with I was looking into how to use and what it would accept. Also the question of if there was any polymorphism (I see now from examples that there is probably not) for events, where function signature of handle_events_with would determine which subset of events it would handle and so on.

nicholassm commented 1 month ago

Hi bluss,

I've made the builder module pub now and added documentation. See version 3.1.0. I'm a bit blinded by having worked so much on the code base - so does it make sense to you? If you have any suggestions for improvements, I'm very happy to receive Pull Requests :-)

Kind regards, Nicholas

bluss commented 1 month ago

Nice, thanks for making it visible. Now the types involved are clickable in docs and it's possible to understand more parts of the API.

nicholassm commented 1 month ago

Any suggestions for improvements? Otherwise, I'll close this issue.

Kind regards Nicholas

bluss commented 1 month ago

No suggestions right now! 🙂

nicholassm commented 1 month ago

Cool, closing now.