Trait OidPrefix

Source
pub trait OidPrefix {
    // Provided methods
    fn prefix() -> &'static str { ... }
    fn str_partial_eq(s: &str) -> bool { ... }
}
Expand description

Defines the converting a type to a prefix of an OID

NOTE This should be a static representation of the type irrelevant of any value in a type instance

Provided Methods§

Source

fn prefix() -> &'static str

Get the static string representation of the prefix.

The default representation is to use the type name itself.

Source

fn str_partial_eq(s: &str) -> bool

A partial equality check for the prefix. This is useful in cases when converting from a string to an Typed-OID where the type and string prefix are not the same.

§Examples
#[derive(Debug)]
struct A;
impl OidPrefix for A {
    fn str_partial_eq(s: &str) -> bool { "apple" == s }
}

let oid: Oid<A> = "apple-4GKFGPRVND4QT3PDR90PDKF66O".parse().unwrap();

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§