Skip to main content

EmbeddedContent

Struct EmbeddedContent 

Source
pub struct EmbeddedContent<'a> {
    pub language: EmbeddedLanguage,
    pub content: &'a str,
    pub indent_depth: usize,
    pub file_byte_offset: usize,
}
Expand description

A request to format embedded content within an SVG document.

§Examples

let embedded = svg_format::EmbeddedContent {
    language: svg_format::EmbeddedLanguage::Css,
    content: ".icon{fill:red}",
    indent_depth: 1,
    file_byte_offset: 12,
};
assert_eq!(embedded.language, svg_format::EmbeddedLanguage::Css);

Fields§

§language: EmbeddedLanguage

The language of the embedded content.

§content: &'a str

The raw content text (common indent removed).

§indent_depth: usize

The nesting depth in the SVG tree where this content lives.

§file_byte_offset: usize

Byte offset in the original SVG source where the embedded payload begins: the first non-whitespace content byte, past any <![CDATA[ prefix and the common leading indentation.

This is a block anchor, not a byte-for-byte map. content is a transformed view of the source — common indentation is stripped per line, CRLF is normalized to LF, and (outside CDATA) XML entities are decoded — so it is generally not byte-identical to &source[file_byte_offset..]. A host callback can use this to locate where the embedded region starts, but interior (line, col) positions within content cannot be recovered by counting bytes from this offset; that would require a full source map.

Auto Trait Implementations§

§

impl<'a> Freeze for EmbeddedContent<'a>

§

impl<'a> RefUnwindSafe for EmbeddedContent<'a>

§

impl<'a> Send for EmbeddedContent<'a>

§

impl<'a> Sync for EmbeddedContent<'a>

§

impl<'a> Unpin for EmbeddedContent<'a>

§

impl<'a> UnsafeUnpin for EmbeddedContent<'a>

§

impl<'a> UnwindSafe for EmbeddedContent<'a>

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.