ImagePath

Struct ImagePath 

Source
pub struct ImagePath { /* private fields */ }
Expand description

A wrapper for a path that is a file. It can be either an animated wallpaper or a static wallpaper.

Implementations§

Source§

impl ImagePath

Source

pub fn new(path: PathBuf) -> Option<Self>

Source

pub fn is_animated(&mut self, settings: &Settings) -> bool

Checks if the given path is an animated wallpaper, if the value has been set before it will return the cached value, else it will check if the path is an animated wallpaper and cache the result.

An animated wallperper can be either a file or a folder. If it is a folder it must be contained in the wallpaper directory. If it is a file it must be contained in a folder that is contained in the wallpaper directory.

Example: wallpaper_dir |— folder1 | |— wallpaper1 |– wallpaper2

folder1 is an animated wallpaper wallpaper1 is an animated wallpaper wallpaper2 is not an animated wallpaper

Source

pub fn get_animated_wallpaper_name(&self) -> String

Gets the name of the folder that contains the given path. If the folder name is not cached it will cache it.

§Panics

If the path is not an animated wallpaper it may panic.

Source

pub const fn get_animated_number(&self) -> Option<u32>

Source

pub fn path(&self) -> &Path

Source

pub fn get_sleep_time(&mut self, settings: &Settings) -> Result<u64>

Trait Implementations§

Source§

impl Display for ImagePath

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<String> for ImagePath

Source§

fn from(path: String) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V