Debian Codegraph @

src/node/text.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::hash_maprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash_map/::DefaultHasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/DefaultHasher#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::hashrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/::Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#;
4
5 use craterust-analyzer cargo svg 0.18.0 crate/::noderust-analyzer cargo svg 0.18.0 node/::Noderust-analyzer cargo svg 0.18.0 node/Node#;
6
7 /// A text node.
8 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
9 pub struct Textrust-analyzer cargo svg 0.18.0 node/text/Text# {
10 contentrust-analyzer cargo svg 0.18.0 node/text/Text#content.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
11 }
12
13 impl Textrust-analyzer cargo svg 0.18.0 node/text/Text# {
14 /// Create a node.
15 #[inline]
16 pub fn newrust-analyzer cargo svg 0.18.0 node/text/impl#[Text]new().<T>(content: T) -> Selfrust-analyzer cargo svg 0.18.0 node/text/impl#[Text]
17 where
18 T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
19 {
20 Textrust-analyzer cargo svg 0.18.0 node/text/Text# {
21 contentrust-analyzer cargo svg 0.18.0 node/text/Text#content.: content.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(),
22 }
23 }
24 }
25
26 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Textrust-analyzer cargo svg 0.18.0 node/text/Text# {
27 #[inline]
28 fn fmtrust-analyzer cargo svg 0.18.0 node/text/impl#[Text][Display]fmt().(&self, formatter: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
29 escaperust-analyzer cargo svg 0.18.0 node/text/escape().(&self.contentrust-analyzer cargo svg 0.18.0 node/text/Text#content.).fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Display]fmt().(formatter)
30 }
31 }
32
33 impl Noderust-analyzer cargo svg 0.18.0 node/Node# for Textrust-analyzer cargo svg 0.18.0 node/text/Text# {
34 #[inline]
35 fn get_namerust-analyzer cargo svg 0.18.0 node/text/impl#[Text][Node]get_name().(&self) -> &str {
36 "text"
37 }
38
39 #[inline]
40 fn is_barerust-analyzer cargo svg 0.18.0 node/text/impl#[Text][Node]is_bare().(&self) -> bool {
41 true
42 }
43 }
44
45 impl superrust-analyzer cargo svg 0.18.0 node/::NodeDefaultHashrust-analyzer cargo svg 0.18.0 node/NodeDefaultHash# for Textrust-analyzer cargo svg 0.18.0 node/text/Text# {
46 #[inline]
47 fn default_hashrust-analyzer cargo svg 0.18.0 node/text/impl#[Text][NodeDefaultHash]default_hash().(&self, state: &mut DefaultHasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/DefaultHasher#) {
48 self.contentrust-analyzer cargo svg 0.18.0 node/text/Text#content..hashrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Hash]hash().(state);
49 }
50 }
51
52 pub(craterust-analyzer cargo svg 0.18.0 crate/) fn escaperust-analyzer cargo svg 0.18.0 node/text/escape().(value: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
53 value
54 .replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().('&', "&amp;")
55 .replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().('<', "&lt;")
56 .replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().('>', "&gt;")
57 }