[][src]Struct hyperbole::tree::PathSpec

#[repr(C)]pub struct PathSpec<P> { /* fields omitted */ }

A uri specification and well-typed parameter parser.

See the path! macro for usage details.

Implementations

impl PathSpec<HNil>[src]

pub const ROOT: Self[src]

The root path.

impl<P> PathSpec<P>[src]

pub fn segment(self, name: &'static str) -> Self[src]

Append a static segment to this spec.

Panics

This panics if the segment contains /, or if the path spec already contains a catch-all parameter.

pub fn dynamic<T: FromStr>(
    self,
    name: &'static str
) -> PathSpec<<P as Add<HCons<T, HNil>>>::Output> where
    P: Add<HCons<T, HNil>>, 
[src]

Append a dynamic path parameter of type T to this spec.

Panics

This panics if the path spec already contains a catch-all parameter.

pub fn catch_all<T: FromStr>(
    self,
    name: &'static str
) -> PathSpec<<P as Add<HCons<T, HNil>>>::Output> where
    P: Add<HCons<T, HNil>>, 
[src]

Append a catch-all path parameter of type T to this spec.

Panics

This panics if the path spec already contains a catch-all parameter.

pub fn query<T: FromStr>(
    self,
    name: &'static str
) -> PathSpec<<P as Add<HCons<T, HNil>>>::Output> where
    P: Add<HCons<T, HNil>>, 
[src]

Add a query parameter of type T to this spec.

Panics

This panics if the path spec already contains a query parameter with the same name.

Trait Implementations

impl<P> Clone for PathSpec<P>[src]

impl<P> Display for PathSpec<P>[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

use hyperbole::path;
use std::fmt::Display;

fn eq<D: Display>(a: &str, b: D) {
    assert_eq!(a, format!("{}", b));
}

eq("/", path![]);
eq("/", path![? p1: u8]);
eq("/one/:two/three", path!["one" / two: u32 / "three"]);
eq("/one/:two/three", path!["one" / two: u32 / "three" ? p1: u8]);
eq("/one/:two/*three", path!["one" / two: u32 / *three: String]);
eq("/one/:two/*three", path!["one" / two: u32 / *three: String ? p1: u8]);

Auto Trait Implementations

impl<P> RefUnwindSafe for PathSpec<P>

impl<P> Send for PathSpec<P>

impl<P> Sync for PathSpec<P>

impl<P> Unpin for PathSpec<P>

impl<P> UnwindSafe for PathSpec<P>

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<Choices> CoproductSubsetter<CNil, HNil> for Choices[src]

type Remainder = Choices

impl<T> From<T> for T[src]

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

impl<T, U, I> LiftInto<U, I> for T where
    U: LiftFrom<T, I>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<Source> Sculptor<HNil, HNil> for Source[src]

type Remainder = Source

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.