Skip to content

Commit 393369f

Browse files
committed
---
yaml --- r: 220614 b: refs/heads/tmp c: 092f4ed h: refs/heads/master v: v3
1 parent ed4a8d8 commit 393369f

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: c8bab9d06a179028a0d5129aa62f09d694d9cc49
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: ff664f3c6cc0b9b530406c2ffb380040b4c4fc88
28+
refs/heads/tmp: 092f4ed2de83884661373b6ce7cd217a7b9860ee
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1b28ffa5216c845d1cef6b0cb3e5ac7db12025d0
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/libstd/io/mod.rs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -692,17 +692,38 @@ pub trait Write {
692692
}
693693
}
694694

695-
/// An object implementing `Seek` internally has some form of cursor which can
696-
/// be moved within a stream of bytes.
695+
/// The `Seek` trait provides a cursor which can be moved within a stream of
696+
/// bytes.
697697
///
698698
/// The stream typically has a fixed size, allowing seeking relative to either
699699
/// end or the current offset.
700+
///
701+
/// # Examples
702+
///
703+
/// [`File`][file]s implement `Seek`:
704+
///
705+
/// [file]: ../std/fs/struct.File.html
706+
///
707+
/// ```
708+
/// use std::io;
709+
/// use std::fs::File;
710+
/// use std::io::Seek;
711+
/// use std::io::SeekFrom;
712+
///
713+
/// # fn foo() -> io::Result<()> {
714+
/// let mut f = try!(File::open("foo.txt"));
715+
///
716+
/// // move the cursor 42 bytes from the start of the file
717+
/// f.seek(SeekFrom::Start(42)).unwrap();
718+
/// # Ok(())
719+
/// # }
720+
/// ```
700721
#[stable(feature = "rust1", since = "1.0.0")]
701722
pub trait Seek {
702-
/// Seek to an offset, in bytes, in a stream
723+
/// Seek to an offset, in bytes, in a stream.
703724
///
704-
/// A seek beyond the end of a stream is allowed, but seeking before offset
705-
/// 0 is an error.
725+
/// A seek beyond the end of a stream is allowed, but implementation
726+
/// defined.
706727
///
707728
/// The behavior when seeking past the end of the stream is implementation
708729
/// defined.
@@ -712,7 +733,7 @@ pub trait Seek {
712733
///
713734
/// # Errors
714735
///
715-
/// Seeking to a negative offset is considered an error
736+
/// Seeking to a negative offset is considered an error.
716737
#[stable(feature = "rust1", since = "1.0.0")]
717738
fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
718739
}

0 commit comments

Comments
 (0)