Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database::open() should use generic parameter #193

Closed
ahrensburger opened this issue Nov 20, 2023 · 3 comments
Closed

Database::open() should use generic parameter #193

ahrensburger opened this issue Nov 20, 2023 · 3 comments

Comments

@ahrensburger
Copy link

Thanks again for fixing the bug I ran into. :-)

I'd further more like to use a database stored on an S3 bucket, using crate s3reader right away, which implements the read trait. Therefore it would be really helpful, if Database::open() would support specifying a class implementing the std::io::Read trait, as such (or similar):

pub fn open<R: std::io::Read>(
source: &mut dyn R,
key: DatabaseKey,
) -> Result<Database, DatabaseOpenError> {
...
}

I didn't compile and test it, but I hope you got my point. :-)

@louib
Copy link
Collaborator

louib commented Nov 25, 2023

@ahrensburger in the meantime, you can also use the parse(data: &[u8], key: DatabaseKey) function, which I introduced when fixing the first bug you reported.

@sseemayer
Copy link
Owner

@ahrensburger are you sure this isn't already possible? The Database::open signature takes source: &mut dyn std::io::Read, which should be compatible with the S3Reader.

@sseemayer
Copy link
Owner

Closing as current solution is probably good enough, please feel free to re-open with more context.

@sseemayer sseemayer closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants