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

How do I do it for seek_mut()? #65

Closed
rockit-ba opened this issue Jan 15, 2023 · 2 comments
Closed

How do I do it for seek_mut()? #65

rockit-ba opened this issue Jan 15, 2023 · 2 comments

Comments

@rockit-ba
Copy link

like this:

use memmap2::MmapMut;

let mut mmap = MmapMut::open_path(file_path, memmap2::Protection::ReadWrite)?;
mmap.seek_mut(10)?; 
@adamreichold
Copy link

adamreichold commented Jan 15, 2023

Is not clear what you mean by seek_mut. You also seem to refer to the API of another crate as this crate does have an open_path method or a Protection enum.

Do you mean how to turn MmapMut into an instance of Seek? If so, then the answer is to wrap it in a Cursor, e.g.

let mmap = MmapMut::open(file)?;
let mut cursor = Cursor::new(mmap);
cursor.seek(SeekFrom::Start(10))?; 

@rockit-ba
Copy link
Author

Is not clear what you mean by seek_mut. You also seem to refer to the API of another crate as this crate does have an open_path method or a Protection enum.

Do you mean how to turn MmapMut into an instance of Seek? If so, then the answer to wrap it in a Cursor, e.g.

let mmap = MmapMut::open(file)?;
let mut cursor = Cursor::new(mmap);
cursor.seek(SeekFrom::Start(10))?; 

ok thanks

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

2 participants