Coverage Report

Created: 2026-10-28 07:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/const-oid-0.10.2/src/traits.rs
Line
Count
Source
1
//! Trait definitions.
2
3
use crate::ObjectIdentifier;
4
5
/// A trait which associates an OID with a type.
6
pub trait AssociatedOid {
7
    /// The OID associated with this type.
8
    const OID: ObjectIdentifier;
9
}
10
11
/// A trait which associates a dynamic, `&self`-dependent OID with a type,
12
/// which may change depending on the type's value.
13
///
14
/// This trait is object safe and auto-impl'd for any types which impl
15
/// [`AssociatedOid`].
16
pub trait DynAssociatedOid {
17
    /// Get the OID associated with this value.
18
    fn oid(&self) -> ObjectIdentifier;
19
}
20
21
impl<T: AssociatedOid> DynAssociatedOid for T {
22
0
    fn oid(&self) -> ObjectIdentifier {
23
0
        T::OID
24
0
    }
25
}