fix docs & example for FileExt::write_at
This commit is contained in:
parent
39f42ad9e8
commit
e7dc177442
@ -149,7 +149,14 @@ fn read_exact_at(&self, mut buf: &mut [u8], mut offset: u64) -> io::Result<()> {
|
|||||||
/// Note that similar to [`File::write`], it is not an error to return a
|
/// Note that similar to [`File::write`], it is not an error to return a
|
||||||
/// short write.
|
/// short write.
|
||||||
///
|
///
|
||||||
|
/// # Bug
|
||||||
|
/// On some systems, due to a [bug] with [`pwrite64`] (the underlying
|
||||||
|
/// syscall), files opened with the `O_APPEND` flag fail to respect the
|
||||||
|
/// offset parameter, always appending to the end of the file instead.
|
||||||
|
///
|
||||||
/// [`File::write`]: fs::File::write
|
/// [`File::write`]: fs::File::write
|
||||||
|
/// [`pwrite64`]: https://man7.org/linux/man-pages/man2/pwrite.2.html
|
||||||
|
/// [bug]: https://man7.org/linux/man-pages/man2/pwrite.2.html#BUGS
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -159,7 +166,7 @@ fn read_exact_at(&self, mut buf: &mut [u8], mut offset: u64) -> io::Result<()> {
|
|||||||
/// use std::os::unix::prelude::FileExt;
|
/// use std::os::unix::prelude::FileExt;
|
||||||
///
|
///
|
||||||
/// fn main() -> io::Result<()> {
|
/// fn main() -> io::Result<()> {
|
||||||
/// let file = File::open("foo.txt")?;
|
/// let file = File::create("foo.txt")?;
|
||||||
///
|
///
|
||||||
/// // We now write at the offset 10.
|
/// // We now write at the offset 10.
|
||||||
/// file.write_at(b"sushi", 10)?;
|
/// file.write_at(b"sushi", 10)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user