pub struct File {
pub poster: String,
pub posted_at: DateTime<Utc>,
pub subject: String,
pub groups: Vec<String>,
pub segments: Vec<Segment>,
}
Expand description
Represents a complete file, consisting of segments that make up a file.
Fields§
§poster: String
The poster of the file.
posted_at: DateTime<Utc>
The date and time when the file was posted, in UTC.
subject: String
The subject of the file.
groups: Vec<String>
Groups that reference the file.
segments: Vec<Segment>
Segments that make up the file.
Implementations§
Source§impl File
impl File
Sourcepub fn new(
poster: impl Into<String>,
posted_at: impl Into<DateTime<Utc>>,
subject: impl Into<String>,
groups: impl IntoIterator<Item = impl Into<String>>,
segments: impl IntoIterator<Item = Segment>,
) -> Self
pub fn new( poster: impl Into<String>, posted_at: impl Into<DateTime<Utc>>, subject: impl Into<String>, groups: impl IntoIterator<Item = impl Into<String>>, segments: impl IntoIterator<Item = Segment>, ) -> Self
Creates a new File
instance.
Sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
Complete name of the file with it’s extension extracted from the subject.
May return None
if it fails to extract the name.
Sourcepub fn stem(&self) -> Option<&str>
pub fn stem(&self) -> Option<&str>
Base name of the file without it’s extension extracted from the File::name
.
May return None
if it fails to extract the stem.
Sourcepub fn extension(&self) -> Option<&str>
pub fn extension(&self) -> Option<&str>
Extension of the file extracted from the File::name
.
May return None
if it fails to extract the extension.
Sourcepub fn has_extension(&self, ext: impl AsRef<str>) -> bool
pub fn has_extension(&self, ext: impl AsRef<str>) -> bool
Sourcepub fn is_obfuscated(&self) -> bool
pub fn is_obfuscated(&self) -> bool
Trait Implementations§
Source§impl Ord for File
impl Ord for File
Source§impl PartialOrd for File
impl PartialOrd for File
impl Eq for File
impl StructuralPartialEq for File
Auto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more