paved 0.6.0

A simple platform agnostic path representation
Documentation
use std::ffi::OsString;

use crate::{PathPrefix, PathType, PavedPath};

impl PavedPath {
    /// Returns a reference to the contained file, if present
    pub fn get_file(&self) -> Option<&OsString> {
        self.file.as_ref()
    }

    /// Returns [true] if the file is [`Option::Some`], and [false] if the file is [`Option::None`]
    pub fn has_file(&self) -> bool {
        self.file.is_some()
    }

    /// Returns a reference to the contained [`Vec<OsString>`] containing a list of directories
    pub fn get_dirs(&self) -> &Vec<OsString> {
        &self.directories
    }

    /// Returns a reference to the contained [`PathType`]
    pub fn get_type(&self) -> PathType {
        self.path_type
    }

    /// Returns if the path is absolute, [true] if it is, [false] if it isn't
    pub fn is_absolute(&self) -> bool {
        self.path_type == PathType::Absolute
    }

    /// Returns if the path is relative, [true] if it is, [false] if it isn't
    pub fn is_relative(&self) -> bool {
        self.path_type == PathType::Relative
    }

    /// Returns a reference to the contained [`PathPrefix`] if one exists
    pub fn get_prefix(&self) -> Option<&PathPrefix> {
        self.path_prefix.as_ref()
    }

    /// Returns the last directory if present, does not return the file if one is set
    pub fn last(&self) -> Option<&OsString> {
        self.directories.last()
    }
}