Skip to main content

BoundExt

Trait BoundExt 

Source
pub trait BoundExt<T> {
    // Required method
    fn try_map<U, E, F>(self, f: F) -> Result<Bound<U>, E>
       where F: FnOnce(T) -> Result<U, E>;
}
Expand description

Extension trait for std::ops::Bound to allow fallible mapping of its contents.

This is useful in situations where range bounds must be converted into a different type prior to range-queries (e.g. converting a Bound<usize> received from an API but needing to index into an internal structure requiring Bound<std::num::NonZeroU16>), where the conversion operation itself is fallible (e.g. try_from).

Required Methods§

Source

fn try_map<U, E, F>(self, f: F) -> Result<Bound<U>, E>
where F: FnOnce(T) -> Result<U, E>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> BoundExt<T> for Bound<T>

Source§

fn try_map<U, E, F>(self, f: F) -> Result<Bound<U>, E>
where F: FnOnce(T) -> Result<U, E>,

Implementors§