| 1 | //! Trait definitions. |
| 2 | |
| 3 | use craterust-analyzer cargo const-oid 0.10.2 crate/::ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#; |
| 4 | |
| 5 | /// A trait which associates an OID with a type. |
| 6 | pub trait AssociatedOidrust-analyzer cargo const-oid 0.10.2 traits/AssociatedOid# { |
| 7 | /// The OID associated with this type. |
| 8 | const OIDrust-analyzer cargo const-oid 0.10.2 traits/AssociatedOid#OID.: ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 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 DynAssociatedOidrust-analyzer cargo const-oid 0.10.2 traits/DynAssociatedOid# { |
| 17 | /// Get the OID associated with this value. |
| 18 | fn oidrust-analyzer cargo const-oid 0.10.2 traits/DynAssociatedOid#oid().(&self) -> ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier#; |
| 19 | } |
| 20 | |
| 21 | impl<T: AssociatedOidrust-analyzer cargo const-oid 0.10.2 traits/AssociatedOid#> DynAssociatedOidrust-analyzer cargo const-oid 0.10.2 traits/DynAssociatedOid# for T { |
| 22 | fn oidrust-analyzer cargo const-oid 0.10.2 traits/impl#[T][DynAssociatedOid]oid().(&self) -> ObjectIdentifierrust-analyzer cargo const-oid 0.10.2 ObjectIdentifier# { |
| 23 | T::OIDrust-analyzer cargo const-oid 0.10.2 traits/AssociatedOid#OID. |
| 24 | } |
| 25 | } |