John Vandenberg
b3a3c5ce28
Apply clippy fixes
2025-01-23 09:36:01 +08:00
Dan Gohman
590386a388
Fix compilation errors with feature = io_safety
.
...
Fix a typo of "io-safety" in place of "io_safety", and fix various
compilation errors exposed by this fix.
2024-08-20 17:40:24 -07:00
John Nunley
c17710366b
Update src/fs/file.rs
...
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2023-05-01 07:05:30 -07:00
jtnunley
dc7bb8e97d
Fix minor issues
2023-04-30 10:00:35 -07:00
jtnunley
c63c43341a
add end-of-file newline
2023-04-30 09:58:28 -07:00
jtnunley
e1d66f53a2
code review
2023-04-30 09:58:28 -07:00
jtnunley
7c408f11dc
add I/O safe traits
2023-04-30 09:58:28 -07:00
Martin Nordholts
d22585d7de
Prevent races between dropping File LockGuard and waking its tasks
...
By changing the inner `LockGuard` value to an `Option` and setting it to
`None` in `drop()` so we can drop the `Arc` _before_ waking its tasks.
2023-04-07 06:05:48 +02:00
Josh Triplett
dfdf56cc9a
Test that file EOF is not permanent: reading again should give new data
2022-06-30 02:02:28 -07:00
Josh Triplett
64b7791ee5
When read returns EOF, ensure future reads still check the file for EOF
...
Go back to the idle mode when returning EOF, so that the next read will
make another attempt to read from the file in case the file grew.
2022-06-30 02:02:28 -07:00
Josh Triplett
955fa65a64
Fix whitespace errors in a test
2022-06-20 03:53:33 -07:00
Jasper van Herpt
6f61c9dc7e
Match error message from async File::create std File::create
2021-10-14 20:40:51 +02:00
Dan Gohman
09e99843e4
Implement Clone for File.
...
Implement `Clone` for `File` so that `File`s can be passed into closures
for use in `spawn_blocking`. `File`'s contents are already wrapped in
`Arc`s, so the implementation of `clone` is straightforward.
This also aligns with `TcpStream` which already implements `Clone` using
its internal `Arc`.
2021-01-15 09:08:37 -08:00
Marc-Antoine Perennou
48693fccc3
switch to futures-lite
...
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-07-24 23:02:10 +02:00
jerry73204
d60e7cc27d
Fix wrong slice index when reading a file
2020-05-29 19:18:06 +08:00
dignifiedquire
19170aead4
use local file
2020-05-09 11:44:16 +02:00
dignifiedquire
2762ec5800
fix(fs): use smol::block_on for drop handling of File
...
Ref #766
2020-05-09 11:36:13 +02:00
Yoshua Wuyts
46cafffc31
Merge pull request #571 from killercup/more-errors
...
Add context to more errors
2019-11-27 01:54:27 +01:00
Pascal Hertleif
aa7d1c27a4
Verbose errors: Apply suggestions
...
Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2019-11-25 21:18:40 +01:00
Stjepan Glavina
16edec3464
Ignore seek errors in poll_unread
2019-11-21 17:50:30 +01:00
Pascal Hertleif
e01f07d72a
Add context to more errors
...
cc #569
2019-11-21 00:27:47 +01:00
Pascal Hertleif
c704643296
Remove verbose-errors cargo feature
2019-11-19 13:15:48 +01:00
Pascal Hertleif
8ce3e78952
verbose errors feature
...
This adds a new "verbose-errors" feature flag to async-std that enables
wrapping certain errors in structures with more context. As an example,
we use it in `fs::File::{open,create}` to add the given path to the
error message (something that is lacking in std to annoyance of many).
2019-11-17 21:54:44 +01:00
Stjepan Glavina
3dd59d7056
Refactor the task module ( #421 )
...
* Refactor the task module
* Fix clippy warning
* Simplify task-local entries
* Reduce the amount of future wrapping
* Cleanup
* Simplify stealing
2019-11-01 02:45:33 +01:00
Stjepan Glavina
8bef2e9e95
Don't flush files if they weren't written to
2019-10-17 21:28:38 +02:00
Stjepan Glavina
ec23632f3e
Cleanup: replace cfg-if with our macros ( #361 )
...
* Cleanup: replace cfg-if with our macros
* Prefix macros with cfg_
* Remove #[macro_export] from internal macros
2019-10-17 19:17:49 +02:00
Yoshua Wuyts
b4c1c63fd2
task::blocking async closure -> FnOnce
...
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 16:01:24 +02:00
Stjepan Glavina
504f8cb137
Use crate::path everywhere
2019-10-15 01:25:20 +02:00
Stjepan Glavina
1fa196812a
Fix compilation errors around Stream
2019-09-21 15:05:57 +02:00
Stjepan Glavina
edfa2358a4
Re-export IO traits from futures
2019-09-21 14:30:52 +02:00
Stjepan Glavina
a4381230b8
Clean up the fs module and a few other places
2019-09-14 01:24:31 +02:00
Stjepan Glavina
2c02037673
Fix a typo
2019-09-09 09:18:56 +02:00
Stjepan Glavina
41f345d319
Fix a bug in conversion of File into raw handle
2019-09-08 19:19:34 +02:00
Stjepan Glavina
8c00cc53ce
Flush more often to prevent flushes during seek
2019-09-08 12:14:07 +02:00
Stjepan Glavina
6ed0e857fd
Fix some typos, expand comments
2019-09-08 10:43:47 +02:00
Stjepan Glavina
17c95a39d7
More robust file implementation
...
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-07 23:17:20 +02:00
Stjepan Glavina
bac74c2d7f
Reduce dependency on futures crate ( #140 )
...
* Add future::poll_fn
* Replace all uses of poll_fn with the new one
* Remove some uses of futures
* Simplify ReadDir and DirEntry
* Remove some use of futures from File
* Use futures subcrates
* Fix imports in docs
* Remove futures-util dependency
* Remove futures-executor-preview
* Refactor
* Require more features in the futures-preview crate
2019-09-05 01:22:41 +02:00
Yoshua Wuyts
63ad786768
remove async_await feature gate
...
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-08-21 00:29:35 -07:00
Stjepan Glavina
9b3e8b8f26
Use our own Sink/Empty and fix compilation errors
2019-08-15 11:47:20 +02:00
Stjepan Glavina
e459bd048e
Cleanup and docs
2019-08-14 04:22:37 +02:00
Stjepan Glavina
1f9628d8ad
Cleanup
2019-08-12 20:29:16 +02:00
Stjepan Glavina
9d8ac36813
Rename feature docs.rs to docs
2019-08-12 19:50:30 +02:00
Stjepan Glavina
68d7a9c34e
Refactor
2019-08-12 18:38:59 +02:00
Stjepan Glavina
a430e27819
Cleanup, docs, fmt
2019-08-12 18:00:21 +02:00
Stjepan Glavina
e44451a042
Revamp IO traits and Stream trait
2019-08-12 12:50:35 +02:00
Stjepan Glavina
3f4a56abdc
Reformat doc examples
2019-08-09 02:56:59 +02:00
Florian Gilcher
5b0a6269a9
Initial commit
2019-08-08 14:44:48 +02:00