Struct lava_torrent::torrent::v1::File
source · pub struct File {
pub length: Integer,
pub path: PathBuf,
pub extra_fields: Option<Dictionary>,
}
Expand description
A file contained in a torrent.
Modeled after the specifications
in BEP 3. Unknown/extension
fields will be placed in extra_fields
. If you need
any of those extra fields you would have to parse it yourself.
Fields§
§length: Integer
File size in bytes.
path: PathBuf
File path, relative to Torrent
’s name
field.
extra_fields: Option<Dictionary>
Fields not defined in BEP 3.
Implementations§
source§impl File
impl File
sourcepub fn absolute_path<P>(&self, parent: P) -> Result<PathBuf, LavaTorrentError>where
P: AsRef<Path>,
pub fn absolute_path<P>(&self, parent: P) -> Result<PathBuf, LavaTorrentError>where P: AsRef<Path>,
Construct the File
’s absolute path using parent
.
Caller has to ensure that parent
is an absolute path.
Otherwise an error would be returned.
This method effectively appends/joins self.path
to parent
.
Trait Implementations§
source§impl PartialEq<File> for File
impl PartialEq<File> for File
impl Eq for File
impl StructuralEq for File
impl StructuralPartialEq for File
Auto Trait Implementations§
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations§
source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere Scheme: ApproxScheme,
source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
source§fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject with the default scheme.
source§fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,
Approximate the subject with a specific scheme.
source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
source§fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
fn into_as<Dst>(self) -> Dstwhere Self: Sized + Into<Dst>,
Convert the subject to a given type.