socketry-markdown 0.1.1

CommonMark compliant markdown parser in Rust with ASTs and extensions
Documentation
// Released under the MIT License.
// Copyright, 2024, by Bnchi.
// Copyright, 2024, by Titus Wormer.
// Copyright, 2026, by Samuel Williams.

//! Traits for <https://github.com/syntax-tree/mdast#association>.
//!
//! JS equivalent: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/70e1a4f/types/mdast/index.d.ts#L48.
use crate::mdast::{Definition, ImageReference, LinkReference};
use alloc::string::String;

pub trait Association {
    fn identifier(&self) -> &String;
    fn label(&self) -> &Option<String>;
}

impl Association for Definition {
    fn identifier(&self) -> &String {
        &self.identifier
    }

    fn label(&self) -> &Option<String> {
        &self.label
    }
}

impl Association for ImageReference {
    fn identifier(&self) -> &String {
        &self.identifier
    }

    fn label(&self) -> &Option<String> {
        &self.label
    }
}

impl Association for LinkReference {
    fn identifier(&self) -> &String {
        &self.identifier
    }

    fn label(&self) -> &Option<String> {
        &self.label
    }
}