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

Support std::io::{Read, Write, Seek} #33

Closed
ikrivosheev opened this issue Sep 29, 2021 · 3 comments
Closed

Support std::io::{Read, Write, Seek} #33

ikrivosheev opened this issue Sep 29, 2021 · 3 comments

Comments

@ikrivosheev
Copy link

Hello! Thank you for very useful crate!

Before Rust I wrote in python. Python has its implementation for mmap. In python I can work with mmap like with File
I propose to implement traits std::io::{Read, Write, Seek}. If nobody don't mind, I'm ready to create PR.

@adamreichold
Copy link

A memory map provides access to a byte slice &[u8] resp. &mut [u8] which implements Read and Write. If you need Seek, you'll just need to wrap the slice into a Cursor. So Cursor<MmapMut> should already fulfil the requirement of using a memory map like a file?

@RazrFalcon
Copy link
Owner

Yes, as mentioned about, it should work out of the box.

@ikrivosheev
Copy link
Author

@RazrFalcon @adamreichold, thank for the answer! I got it and it works!

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

No branches or pull requests

3 participants