Trait DataFilesAvailability

Source
pub trait DataFilesAvailability {
    type Result<'err, T>;

    // Required methods
    fn map<T, U>(
        v: Self::Result<'_, T>,
        f: impl FnOnce(T) -> U,
    ) -> Self::Result<'_, U>;
    fn zip<'err, T1, T2>(
        v1: Self::Result<'err, T1>,
        v2: Self::Result<'err, T2>,
    ) -> Self::Result<'err, (T1, T2)>;
    fn make_result<T>(
        value: Self::Result<'_, T>,
    ) -> Result<T, &UnavailableProperty>;
}
Expand description

Helper trait to work with PropertiesResult

It is implemented by:

  • GuaranteedDataFiles: the common case, where data files are guaranteed to exist once a graph is loaded, in which case Self::Result<'err, T> is the same type as T
  • OptionalDataFiles: when they are not, in which case Self::Result<T> is the same type as Result<T, &'err UnavailableProperty>.

Required Associated Types§

Source

type Result<'err, T>

Required Methods§

Source

fn map<T, U>( v: Self::Result<'_, T>, f: impl FnOnce(T) -> U, ) -> Self::Result<'_, U>

Source

fn zip<'err, T1, T2>( v1: Self::Result<'err, T1>, v2: Self::Result<'err, T2>, ) -> Self::Result<'err, (T1, T2)>

Source

fn make_result<T>(value: Self::Result<'_, T>) -> Result<T, &UnavailableProperty>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§