pub struct Chars {
string: RefCell<String>,
space_normalized: RefCell<Option<String>>,
}
Expand description
In SVG text elements, we use Chars
to store character data. For example,
an element like <text>Foo Bar</text>
will be a Text
with a single child,
and the child will be a Chars
with “Foo Bar” for its contents.
Text elements can contain <tspan>
sub-elements. In this case,
those tspan
nodes will also contain Chars
children.
A text or tspan element can contain more than one Chars
child, for example,
if there is an XML comment that splits the character contents in two:
<text>
This sentence will create a Chars.
<!-- this comment is ignored -->
This sentence will cretea another Chars.
</text>
When rendering a text element, it will take care of concatenating the strings
in its Chars
children as appropriate, depending on the
xml:space="preserve"
attribute. A Chars
stores the characters verbatim
as they come out of the XML parser, after ensuring that they are valid UTF-8.
Fields§
§string: RefCell<String>
§space_normalized: RefCell<Option<String>>
Implementations§
source§impl Chars
impl Chars
pub fn new(initial_text: &str) -> Chars
pub fn is_empty(&self) -> bool
pub fn append(&self, s: &str)
fn ensure_normalized_string( &self, node: &Node<NodeData>, values: &ComputedValues )
fn make_span( &self, node: &Node<NodeData>, values: Rc<ComputedValues>, dx: f64, dy: f64, depth: usize, link_target: Option<String> ) -> Span
fn to_chunks( &self, node: &Node<NodeData>, values: Rc<ComputedValues>, chunks: &mut [Chunk], dx: f64, dy: f64, depth: usize, link_target: Option<String> )
pub fn get_string(&self) -> String
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Chars
impl Send for Chars
impl !Sync for Chars
impl Unpin for Chars
impl UnwindSafe for Chars
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.