[][src]Struct radicle_surf::file_system::Label

pub struct Label {
    pub label: String,
    // some fields omitted
}

A label for Directory and File to allow for search.

These are essentially directory and file names.

Examples

use radicle_surf::file_system::error as file_error;
use radicle_surf::file_system::{Label, Path};
use std::convert::TryFrom;

fn build_lib_path() -> Result<Path, file_error::Error> {
    let lib_filename = Label::try_from("lib.rs")?;
    let src_directory_name = Label::try_from("src")?;
    Ok(Path::from_labels(src_directory_name, &[lib_filename]))
}

Fields

label: String

Methods

impl Label[src]

pub fn root() -> Self[src]

The root label for the root directory, i.e. "~".

Prefer creating a root Path, by using Path::root.

Examples

use radicle_surf::file_system::{Label, Path};

let root = Path::root();
assert_eq!(*root.split_first().0, Label::root());

pub fn is_root(&self) -> bool[src]

Trait Implementations

impl Clone for Label[src]

impl Debug for Label[src]

impl Display for Label[src]

impl Eq for Label[src]

impl FromStr for Label[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for Label[src]

impl Ord for Label[src]

impl PartialEq<Label> for Label[src]

impl PartialOrd<Label> for Label[src]

impl StructuralEq for Label[src]

impl StructuralPartialEq for Label[src]

impl<'_> TryFrom<&'_ str> for Label[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Label

impl Send for Label

impl Sync for Label

impl Unpin for Label

impl UnwindSafe for Label

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> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.