[][src]Trait async_std::io::Seek

pub trait Seek {
    fn seek(&mut self, pos: SeekFrom) -> ImplFuture<Result<u64>>
    where
        Self: Unpin
; }

Allows seeking through a byte stream.

This trait is an async version of std::io::Seek.

While it is currently not possible to implement this trait directly, it gets implemented automatically for all types that implement futures::io::AsyncSeek.

Required methods

fn seek(&mut self, pos: SeekFrom) -> ImplFuture<Result<u64>> where
    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 f = File::open("a.txt").await?;

let file_len = f.seek(SeekFrom::End(0)).await?;
Loading content...

Implementors

impl<T: AsyncSeek + Unpin + ?Sized> Seek for T[src]

Loading content...