[−][src]Trait async_std::io::Seek
Allows seeking through a byte stream.
This trait is a re-export of futures::io::AsyncSeek
and is an async version of
std::io::Seek
.
The provided methods do not really exist in the trait itself, but they become
available when SeekExt
the prelude is imported:
use async_std::prelude::*;
Required methods
fn poll_seek(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
pos: SeekFrom
) -> Poll<Result<u64>>
[−]
self: Pin<&mut Self>,
cx: &mut Context<'_>,
pos: SeekFrom
) -> Poll<Result<u64>>
Attempt to seek to an offset, in bytes, in a stream.
Provided methods
fn seek(&mut self, pos: SeekFrom) -> ImplFuture<Result<u64>> where
Self: Unpin,
[−]
Self: Unpin,
Seeks to a new position in a byte stream.
Returns the new position in the byte stream.
A seek beyond the end of stream is allowed, but behavior is defined by the implementation.
Examples
use async_std::fs::File; use async_std::io::SeekFrom; use async_std::prelude::*; let mut file = File::open("a.txt").await?; let file_len = file.seek(SeekFrom::End(0)).await?;
Implementations on Foreign Types
impl<T: Seek + Unpin + ?Sized> Seek for Box<T>
[src][−]
impl<T: Seek + Unpin + ?Sized, '_> Seek for &'_ mut T
[src][−]
Implementors
impl Seek for File
[src][+]
impl<'_> Seek for &'_ File
[src][+]
impl<P> Seek for Pin<P> where
P: DerefMut + Unpin,
<P as Deref>::Target: Seek,
[src][+]
P: DerefMut + Unpin,
<P as Deref>::Target: Seek,
impl<R: Seek> Seek for BufReader<R>
[src][+]
impl<T> Seek for Cursor<T> where
T: AsRef<[u8]> + Unpin,
[src][+]
T: AsRef<[u8]> + Unpin,