PathLike

Struct PathLike 

Source
pub struct PathLike<D, R> { /* private fields */ }
Available on crate feature path only.
Expand description

Special type which helps to output different path-like types. Everything that produces fmt::Display items while being iterated can be outputted this way. Implements crate::Params and intended to be used as argument of crate::WithParams::with_params.

use cubob::{PathLike, WithParams};
 
let path_like_1 = vec!["A", "a", "1"];
let path_like_2 = [1, 2, 3, 4];
 
assert_eq!(path_like_1.with_params(PathLike::STRUCT).to_string(), "A.a.1");
assert_eq!(path_like_1.with_params(PathLike::LIST).to_string(), "A, a, 1");
assert_eq!(path_like_2.with_params(PathLike::FS_RELATIVE).to_string(), "1/2/3/4");
assert_eq!(path_like_2.with_params(PathLike::ROUTE).to_string(), "1->2->3->4");
 

Implementations§

Source§

impl PathLike<char, NoOutput>

Source

pub const STRUCT: &'static Self

Source§

impl PathLike<char, char>

Source

pub const FS_RELATIVE: &'static Self

Source

pub const FS_ABSOLUTE: &'static Self

Source§

impl PathLike<&'static str, NoOutput>

Source

pub const ROUTE: &'static Self

Source

pub const LIST: &'static Self

Source§

impl<D> PathLike<D, NoOutput>

Source

pub fn new(delimiter: D, prepend: bool) -> Self

Source§

impl<D1, R> PathLike<D1, R>

Source

pub fn with_delimiter<D2>(self, delimiter: D2) -> PathLike<D2, R>

Source§

impl<D, R1> PathLike<D, R1>

Source

pub fn with_replacer<R2>(self, replacer: R2) -> PathLike<D, R2>

Source§

impl<D, R> PathLike<D, R>

Source

pub fn with_prepend(self, prepend: bool) -> Self

Trait Implementations§

Source§

impl<D, R, I> Params<I> for PathLike<D, R>
where D: Display, R: Display, I: ?Sized, for<'a> &'a I: IntoIterator<Item: Display>,

Source§

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

Available on crate feature params only.

Auto Trait Implementations§

§

impl<D, R> Freeze for PathLike<D, R>
where D: Freeze, R: Freeze,

§

impl<D, R> RefUnwindSafe for PathLike<D, R>

§

impl<D, R> Send for PathLike<D, R>
where D: Send, R: Send,

§

impl<D, R> Sync for PathLike<D, R>
where D: Sync, R: Sync,

§

impl<D, R> Unpin for PathLike<D, R>
where D: Unpin, R: Unpin,

§

impl<D, R> UnwindSafe for PathLike<D, R>
where D: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<T, P> WithParams<P> for T
where P: Params<T>,

Source§

fn with_params<'a>(&'a self, params: &'a P) -> Parameterized<'a, T, P>

Available on crate feature params only.