Skip to main content

TargetKey

Trait TargetKey 

Source
pub trait TargetKey: Sealed {
    // Required methods
    fn untyped(&self) -> IoTargetKey;
    fn declared(&self) -> Option<Access>;

    // Provided method
    fn admitted_by(&self, actual: Access) -> Result<(), AddTargetCause> { ... }
}
Expand description

A key a target can be registered under: IoTargetKey, which declares nothing, or a Key<A>, which declares the access A names. Sealed, so that no other type can stand for a key that has not been checked against what it claims.

Required Methods§

Source

fn untyped(&self) -> IoTargetKey

The number the ring addresses the target by.

Source

fn declared(&self) -> Option<Access>

The access this key declares for its target, or None for an untyped key.

Provided Methods§

Source

fn admitted_by(&self, actual: Access) -> Result<(), AddTargetCause>

Whether a target that states actual may be registered under this key: a declaration the target covers, or none. What it refuses is the cause to report.

§Errors

AddTargetCause::AccessNotCovered when the key declares more than actual can do.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§