[][src]Trait futures_lite::io::AsyncSeekExt

pub trait AsyncSeekExt: AsyncSeek {
    fn seek(&mut self, pos: SeekFrom) -> SeekFuture<Self>

Important traits for SeekFuture<'_, T>

impl<T: AsyncSeek + Unpin + ?Sized, '_> Future for SeekFuture<'_, T> type Output = Result<u64>;

    where
        Self: Unpin
, { ... } }

Extension trait for AsyncSeek.

Provided methods

fn seek(&mut self, pos: SeekFrom) -> SeekFuture<Self>

Important traits for SeekFuture<'_, T>

impl<T: AsyncSeek + Unpin + ?Sized, '_> Future for SeekFuture<'_, T> type Output = 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 futures_lite::*;

let mut cursor = io::Cursor::new("hello");

// Move the cursor to the end.
cursor.seek(io::SeekFrom::End(0)).await?;

// Check the current position.
assert_eq!(cursor.seek(io::SeekFrom::Current(0)).await?, 5);
Loading content...

Implementors

impl<S: AsyncSeek + ?Sized> AsyncSeekExt for S[src]

Loading content...