Skip to main content

RefId

Trait RefId 

Source
pub trait RefId:
    Schema
    + Clone
    + PartialEq
    + Debug {
    const EXPECTED: Expected;

    // Required methods
    fn parse(spelled: &str) -> Option<Self>;
    fn spell(&self) -> Cow<'_, str>;
}
Expand description

The type of a kind’s ids: how one is spelled in a reference (@user:42), read back, and stored in every other form (a frame packs it as itself — a number as a number).

Required Associated Constants§

Source

const EXPECTED: Expected

What an id of this type looks like, for messages.

Required Methods§

Source

fn parse(spelled: &str) -> Option<Self>

The id spelled is, if it’s one of this type.

Source

fn spell(&self) -> Cow<'_, str>

As written after @kind:.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl RefId for String

Source§

const EXPECTED: Expected = Expected::Text

Source§

fn parse(spelled: &str) -> Option<Self>

Source§

fn spell(&self) -> Cow<'_, str>

Source§

impl RefId for i64

Source§

const EXPECTED: Expected = Expected::Integer

Source§

fn parse(spelled: &str) -> Option<Self>

Source§

fn spell(&self) -> Cow<'_, str>

Source§

impl RefId for u32

Source§

const EXPECTED: Expected = Expected::Unsigned

Source§

fn parse(spelled: &str) -> Option<Self>

Source§

fn spell(&self) -> Cow<'_, str>

Source§

impl RefId for u64

Source§

const EXPECTED: Expected = Expected::Unsigned

Source§

fn parse(spelled: &str) -> Option<Self>

Source§

fn spell(&self) -> Cow<'_, str>

Implementors§

Source§

impl RefId for Uid

Source§

const EXPECTED: Expected = Expected::Uid