Trait rocket::http::uri::fmt::Ignorable

pub trait Ignorable<P>where
    P: Part,{ }
Expand description

Trait implemented by types that can be ignored in uri!.

When a parameter is explicitly ignored in uri! by supplying _ as the parameter’s value, that parameter’s type is required to implement this trait for the corresponding Part.

fn get_item(id: i32, track: Option<u8>) { /* .. */ }

// Ignore the `track` parameter: `Option<u8>` must be `Ignorable`.
uri!(get_item(100, _));
uri!(get_item(id = 100, track = _));

// Provide a value for `track`.
uri!(get_item(100, Some(4)));
uri!(get_item(id = 100, track = Some(4)));


Only Option<T> and Result<T, E> implement this trait. You may implement this trait for your own ignorable types as well:

use rocket::http::uri::fmt::{Ignorable, Query};

impl Ignorable<Query> for MyType { }



impl<T> Ignorable<Query> for Option<T>


impl<T, E> Ignorable<Query> for Result<T, E>