-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
file: parameterize file position #6381
base: master
Are you sure you want to change the base?
file: parameterize file position #6381
Conversation
Thank you. My main concern here is how long do these calls take. We offload all other file operations to That said, I acknowledge that doing this is more difficult if we have to offload it to |
c6e973e
to
964b481
Compare
tokio/src/fs/mocks.rs
Outdated
impl Seek for &'_ MockFile { | ||
impl Seek for MockFile { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to cause a compilation failure. Most likely, you can just undo the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies. That was a mistake. I'm currently working through/experimenting offloading to spawn_blocking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Hopefully it isn't too complicated to do that. What you're doing now may be preferable if offloading is very complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will resolve it in just a moment.
ohh, good thought. Thank you. Co-authored-by: Alice Ryhl <aliceryhl@google.com>
I'm trying to get Clippy working on my rig. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Your code looks good. Can you add a test for this? Then I would be happy to merge it.
Actually, it unfortunately seems like there are a bunch of test failures. |
I will get these tests and failures sorted out. |
Motivation
Closes: #6374
Solution
By initializing the pos field with the correct position from the StdFile, the File struct created by from_std will maintain the same seek position as the original StdFile. I'm looking into expanding the existing test to validate no regressions introduced.