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>, span_element_name: Rc<String>, values: Rc<ComputedValues>, dx: f64, dy: f64, depth: usize, link_target: Option<String>, ) -> Span
fn to_chunks( &self, node: &Node<NodeData>, span_element_name: Rc<String>, 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 !Freeze for Chars
impl !RefUnwindSafe for Chars
impl !Sync for Chars
impl Send for Chars
impl Unpin for Chars
impl UnsafeUnpin 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§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.