GetCanonicalRefs

Trait GetCanonicalRefs 

Source
pub trait GetCanonicalRefs {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn canonical_refs(&self) -> Result<Option<CanonicalRefs>, Self::Error>;
    fn raw_canonical_refs(
        &self,
    ) -> Result<Option<RawCanonicalRefs>, Self::Error>;

    // Provided method
    fn canonical_refs_or_default<D, E>(
        &self,
        default: D,
    ) -> Result<CanonicalRefs, E>
       where D: Fn() -> Result<CanonicalRefs, E>,
             E: From<Self::Error> { ... }
}
Expand description

Implemented by any data type or store that can return CanonicalRefs and RawCanonicalRefs.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn canonical_refs(&self) -> Result<Option<CanonicalRefs>, Self::Error>

Retrieve the CanonicalRefs, returning Some if they are not present, and None if they are missing.

Self::Error is used to return any domain-specific error by the implementing type.

Source

fn raw_canonical_refs(&self) -> Result<Option<RawCanonicalRefs>, Self::Error>

Retrieve the RawCanonicalRefs, returning Some if they are not present, and None if they are missing.

Self::Error is used to return any domain-specific error by the implementing type.

Provided Methods§

Source

fn canonical_refs_or_default<D, E>( &self, default: D, ) -> Result<CanonicalRefs, E>
where D: Fn() -> Result<CanonicalRefs, E>, E: From<Self::Error>,

Retrieve the CanonicalRefs, and in the case of None, then use the default function to return a default set of CanonicalRefs.

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§