[][src]Struct cratetorrent::storage_info::FileInfo

pub struct FileInfo {
    pub path: PathBuf,
    pub len: u64,
    pub torrent_offset: u64,
}

Information about a torrent's file.

Fields

path: PathBuf

The file's relative path from the download directory.

len: u64

The file's length, in bytes.

torrent_offset: u64

The byte offset of the file within the torrent, when all files in torrent are viewed as a single contiguous byte array. This is always 0 for a single file torrent.

Implementations

impl FileInfo[src]

pub fn byte_range(&self) -> Range<u64>[src]

Returns a range that represents the file's first and one past the last bytes' offsets in the torrent.

pub fn torrent_end_offset(&self) -> u64[src]

Returns the file's one past the last byte's offset in the torrent.

pub fn get_slice(&self, torrent_offset: u64, len: u64) -> FileSlice[src]

Returns the slice in file that overlaps with the range starting at the given offset.

Arguments

  • torrent_offset - A byte offset in the entire torrent.
  • len - The length of the byte range, starting from the offset. This may exceed the file length, in which case the returned file length will be smaller.

Panics

This will panic if torrent_offset is smaller than the file's offset in torrent, or if it's past the last byte in file.

Trait Implementations

impl Clone for FileInfo[src]

impl Debug for FileInfo[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.