Trait TreeOrString

Source
pub trait TreeOrString<'c, 'm: 'c, T> {
    // Required methods
    fn from_element(e: Element<'m>) -> Result<T>;
    fn from_string(s: String, doc: Document<'m>) -> Result<T>;
    fn replace_tts<'s: 'c, 'r>(
        tts: &TTS,
        command: &TTSCommandRule,
        prefs: &PreferenceManager,
        rules_with_context: &'r mut SpeechRulesWithContext<'c, 's, 'm>,
        mathml: Element<'c>,
    ) -> Result<T>;
    fn replace<'s: 'c, 'r>(
        ra: &ReplacementArray,
        rules_with_context: &'r mut SpeechRulesWithContext<'c, 's, 'm>,
        mathml: Element<'c>,
    ) -> Result<T>;
    fn replace_nodes<'s: 'c, 'r>(
        rules: &'r mut SpeechRulesWithContext<'c, 's, 'm>,
        nodes: Vec<Node<'c>>,
        mathml: Element<'c>,
    ) -> Result<T>;
    fn highlight_braille(braille: T, highlight_style: String) -> T;
    fn mark_nav_speech(speech: T) -> T;
}
Expand description

As the name says, TreeOrString is either a Tree (Element) or a String It is used to share code during pattern matching

Required Methods§

Source

fn from_element(e: Element<'m>) -> Result<T>

Source

fn from_string(s: String, doc: Document<'m>) -> Result<T>

Source

fn replace_tts<'s: 'c, 'r>( tts: &TTS, command: &TTSCommandRule, prefs: &PreferenceManager, rules_with_context: &'r mut SpeechRulesWithContext<'c, 's, 'm>, mathml: Element<'c>, ) -> Result<T>

Source

fn replace<'s: 'c, 'r>( ra: &ReplacementArray, rules_with_context: &'r mut SpeechRulesWithContext<'c, 's, 'm>, mathml: Element<'c>, ) -> Result<T>

Source

fn replace_nodes<'s: 'c, 'r>( rules: &'r mut SpeechRulesWithContext<'c, 's, 'm>, nodes: Vec<Node<'c>>, mathml: Element<'c>, ) -> Result<T>

Source

fn highlight_braille(braille: T, highlight_style: String) -> T

Source

fn mark_nav_speech(speech: T) -> T

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.

Implementations on Foreign Types§

Source§

impl<'c, 'm: 'c> TreeOrString<'c, 'm, String> for String

Source§

fn from_element(_e: Element<'m>) -> Result<String>

Source§

fn from_string(s: String, _doc: Document<'m>) -> Result<String>

Source§

fn replace_tts<'s: 'c, 'r>( tts: &TTS, command: &TTSCommandRule, prefs: &PreferenceManager, rules_with_context: &'r mut SpeechRulesWithContext<'c, 's, 'm>, mathml: Element<'c>, ) -> Result<String>

Source§

fn replace<'s: 'c, 'r>( ra: &ReplacementArray, rules_with_context: &'r mut SpeechRulesWithContext<'c, 's, 'm>, mathml: Element<'c>, ) -> Result<String>

Source§

fn replace_nodes<'s: 'c, 'r>( rules: &'r mut SpeechRulesWithContext<'c, 's, 'm>, nodes: Vec<Node<'c>>, mathml: Element<'c>, ) -> Result<String>

Source§

fn highlight_braille(braille: String, highlight_style: String) -> String

Source§

fn mark_nav_speech(speech: String) -> String

Source§

impl<'c, 'm: 'c> TreeOrString<'c, 'm, Element<'m>> for Element<'m>

Source§

fn from_element(e: Element<'m>) -> Result<Element<'m>>

Source§

fn from_string(s: String, doc: Document<'m>) -> Result<Element<'m>>

Source§

fn replace_tts<'s: 'c, 'r>( _tts: &TTS, _command: &TTSCommandRule, _prefs: &PreferenceManager, _rules_with_context: &'r mut SpeechRulesWithContext<'c, 's, 'm>, _mathml: Element<'c>, ) -> Result<Element<'m>>

Source§

fn replace<'s: 'c, 'r>( ra: &ReplacementArray, rules_with_context: &'r mut SpeechRulesWithContext<'c, 's, 'm>, mathml: Element<'c>, ) -> Result<Element<'m>>

Source§

fn replace_nodes<'s: 'c, 'r>( rules: &'r mut SpeechRulesWithContext<'c, 's, 'm>, nodes: Vec<Node<'c>>, mathml: Element<'c>, ) -> Result<Element<'m>>

Source§

fn highlight_braille( _braille: Element<'c>, _highlight_style: String, ) -> Element<'m>

Source§

fn mark_nav_speech(_speech: Element<'c>) -> Element<'m>

Implementors§