Struct ExtensionRegistry

Source
pub struct ExtensionRegistry { /* private fields */ }
Available on crate feature plugins only.
Expand description

Central registry for all ASS format extensions

Manages registration and lookup of tag handlers and section processors. Optimized for fast lookup during parsing with minimal memory overhead.

Implementations§

Source§

impl ExtensionRegistry

Source

pub fn new() -> Self

Create a new empty extension registry

Source

pub fn register_tag_handler( &mut self, handler: Box<dyn TagHandler>, ) -> Result<()>

Register a new tag handler

§Arguments
  • handler - Boxed tag handler implementation
§Errors

Returns PluginError::DuplicateHandler if handler name already exists

Source

pub fn register_section_processor( &mut self, processor: Box<dyn SectionProcessor>, ) -> Result<()>

Register a new section processor

§Arguments
  • processor - Boxed section processor implementation
§Errors

Returns PluginError::DuplicateHandler if processor name already exists

Source

pub fn process_tag(&self, tag_name: &str, args: &str) -> Option<TagResult>

Process a tag using registered handlers

§Arguments
  • tag_name - Name of the tag to process
  • args - Tag arguments as string slice
§Returns
  • Some(TagResult) - If a handler was found and executed
  • None - If no handler was registered for this tag
Source

pub fn process_section( &self, section_name: &str, header: &str, lines: &[&str], ) -> Option<SectionResult>

Process a section using registered processors

§Arguments
  • section_name - Name of the section to process
  • header - Section header line
  • lines - All lines in the section
§Returns
  • Some(SectionResult) - If a processor was found and executed
  • None - If no processor was registered for this section
Source

pub fn tag_handler_names(&self) -> Vec<&str>

Get list of registered tag handler names

Source

pub fn section_processor_names(&self) -> Vec<&str>

Get list of registered section processor names

Source

pub fn has_tag_handler(&self, name: &str) -> bool

Check if a tag handler is registered

Source

pub fn has_section_processor(&self, name: &str) -> bool

Check if a section processor is registered

Source

pub fn remove_tag_handler(&mut self, name: &str) -> Option<Box<dyn TagHandler>>

Remove a tag handler by name

§Returns
  • Some(handler) - If handler was found and removed
  • None - If no handler with that name was registered
Source

pub fn remove_section_processor( &mut self, name: &str, ) -> Option<Box<dyn SectionProcessor>>

Remove a section processor by name

§Returns
  • Some(processor) - If processor was found and removed
  • None - If no processor with that name was registered
Source

pub fn clear(&mut self)

Clear all registered handlers and processors

Source

pub fn extension_count(&self) -> usize

Get total number of registered extensions

Trait Implementations§

Source§

impl Debug for ExtensionRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExtensionRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.