keaz / simple-ldap

A easy to use Rust LDAP library with high-level capabilities
MIT License
4 stars 2 forks source link

Streaming search that returns a stream #14

Open StarlessNights opened 1 week ago

StarlessNights commented 1 week ago

First of this looks like a real nice project! There is certainly room for an abstraction over ldap3 (which I'm using currently).

Is your feature request related to a problem? Please describe.

I want to execute a steaming search and "process" the individual results asynchronously. I'm expecting the search results to be big, so I don't want to store it in memory all at once.

Describe the solution you'd like

streaming_search should return a stream instead of a vector containing all the results. In practice it would be a wrapper object around ldap3::SearchStream that implements the stream trait. SearchStream already takes care of the pagination, so probably this could be done with very little logic here.

Describe alternatives you've considered

The same thing could be done upstream in the ldap3 crate, but probably they just want to mirror the LDAP protocol more closely in their API.

Additional context

It would still be relatively simple to just collect the stream into a Vec if the user just wants all the results at once.

keaz commented 1 week ago

@StarlessNights, Thank you for your feature request. Please review the PR #15