Trait rocket::http::uri::Ignorable[]

pub trait Ignorable<P> where
    P: UriPart
{ }

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 UriPart.

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::{Ignorable, Query};

impl Ignorable<Query> for MyType { }

Implementations on Foreign Types

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

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

Loading content...


Loading content...