Trait InputDebug

Source
pub trait InputDebug {
    // Required methods
    fn slice(&self, span: Span) -> &str;
    fn as_cow(&self) -> Cow<'_, [u8]>;
}
Expand description

Trait for handling input data in error reporting and debugging. Provides methods to convert input slices to human-readable strings and to create byte arrays for error storage.

Required Methods§

Source

fn slice(&self, span: Span) -> &str

Returns a string representation of the input at the given span. Used for pretty error messages in diagnostics.

Source

fn as_cow(&self) -> Cow<'_, [u8]>

Converts the input to a borrowed or owned byte array. Used when constructing error objects that need to store input data.

Implementations on Foreign Types§

Source§

impl InputDebug for [&str]

Source§

fn slice(&self, span: Span) -> &str

Source§

fn as_cow(&self) -> Cow<'_, [u8]>

Source§

impl InputDebug for [u8]

Source§

fn slice(&self, span: Span) -> &str

Source§

fn as_cow(&self) -> Cow<'_, [u8]>

Implementors§