Trait btlib::SeekFromExt

source ·
pub trait SeekFromExt {
    // Required method
    fn abs<F, G>(&self, curr: F, end: G) -> Result<u64>
       where F: FnOnce() -> Result<u64>,
             G: FnOnce() -> Result<u64>;

    // Provided methods
    fn abs_no_end<F>(&self, curr: F) -> Result<u64>
       where F: FnOnce() -> Result<u64> { ... }
    fn whence_offset(whence: u32, offset: u64) -> Result<SeekFrom> { ... }
}

Required Methods§

source

fn abs<F, G>(&self, curr: F, end: G) -> Result<u64>where F: FnOnce() -> Result<u64>, G: FnOnce() -> Result<u64>,

Returns the absolute position (offset from the start) this SeekFrom refers to. curr is called in the case this SeekFrom is Current, and is expected to return the current position. end is called in the case this SeekFrom is End, and is expected to return the the position of the end.

Provided Methods§

source

fn abs_no_end<F>(&self, curr: F) -> Result<u64>where F: FnOnce() -> Result<u64>,

Like SeekFromExt::abs except that an error is always returned when SeekFrom::End is given.

source

fn whence_offset(whence: u32, offset: u64) -> Result<SeekFrom>

Converts a C-style (whence, offset) pair into a SeekFrom enum value. See the POSIX man page of lseek for more details.

Implementations on Foreign Types§

source§

impl SeekFromExt for SeekFrom

source§

fn abs<F, G>(&self, curr: F, end: G) -> Result<u64>where F: FnOnce() -> Result<u64>, G: FnOnce() -> Result<u64>,

Implementors§