Debian Codegraph @

src/_private/rustdoc.rs

raw symbols SCIP
1 #[must_use]
2 pub const fn get_title_and_descriptionrust-analyzer cargo schemars 1.2.2 _private/rustdoc/get_title_and_description().(doc: &str) -> (&str, &str) {
3 let doc_bytes = trim_asciirust-analyzer cargo schemars 1.2.2 _private/rustdoc/trim_ascii().(doc.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().());
4
5 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().doc_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() && doc_bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'#' {
6 let title_end_index = match strchrrust-analyzer cargo schemars 1.2.2 _private/rustdoc/strchr().(doc_bytes, b'\n') {
7 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(i) => i,
8 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => doc_bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(),
9 };
10
11 let title = trim_asciirust-analyzer cargo schemars 1.2.2 _private/rustdoc/trim_ascii().(trim_startrust-analyzer cargo schemars 1.2.2 _private/rustdoc/trim_start().(subslicerust-analyzer cargo schemars 1.2.2 _private/rustdoc/subslice().(doc_bytes, 0, title_end_index), b'#'));
12 let description = trim_asciirust-analyzer cargo schemars 1.2.2 _private/rustdoc/trim_ascii().(subslicerust-analyzer cargo schemars 1.2.2 _private/rustdoc/subslice().(doc_bytes, title_end_index, doc_bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()));
13
14 (to_utf8rust-analyzer cargo schemars 1.2.2 _private/rustdoc/to_utf8().(title), to_utf8rust-analyzer cargo schemars 1.2.2 _private/rustdoc/to_utf8().(description))
15 } else {
16 ("", to_utf8rust-analyzer cargo schemars 1.2.2 _private/rustdoc/to_utf8().(doc_bytes))
17 }
18 }
19
20 const fn strchrrust-analyzer cargo schemars 1.2.2 _private/rustdoc/strchr().(bytes: &[u8], chr: u8) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> {
21 let len = bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
22 let mut i = 0;
23 while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().len {
24 if bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().chr {
25 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(i);
26 }
27 i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
28 }
29 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
30 }
31
32 const fn subslicerust-analyzer cargo schemars 1.2.2 _private/rustdoc/subslice().(mut bytes: &[u8], mut start: usize, end: usize) -> &[u8] {
33 let mut trim_end_count = bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().end;
34 if trim_end_count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
35 while let [rest @ .., _last] = bytes {
36 bytes = rest;
37
38 trim_end_count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().1;
39 if trim_end_count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 {
40 break;
41 }
42 }
43 }
44
45 if start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
46 while let [_first, rest @ ..] = bytes {
47 bytes = rest;
48
49 start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().1;
50 if start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 {
51 break;
52 }
53 }
54 }
55
56 bytes
57 }
58
59 const fn to_utf8rust-analyzer cargo schemars 1.2.2 _private/rustdoc/to_utf8().(bytes: &[u8]) -> &str {
60 match corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(bytes) {
61 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) => x,
62 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => panicrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/panic!!("Invalid UTF-8"),
63 }
64 }
65
66 const fn trim_startrust-analyzer cargo schemars 1.2.2 _private/rustdoc/trim_start().(mut bytes: &[u8], chr: u8) -> &[u8] {
67 while let [first, rest @ ..] = bytes {
68 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().first rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().chr {
69 bytes = rest;
70 } else {
71 break;
72 }
73 }
74 bytes
75 }
76
77 const fn trim_asciirust-analyzer cargo schemars 1.2.2 _private/rustdoc/trim_ascii().(mut bytes: &[u8]) -> &[u8] {
78 while let [first, rest @ ..] = bytes {
79 if first.is_ascii_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii_whitespace().() {
80 bytes = rest;
81 } else {
82 break;
83 }
84 }
85
86 while let [rest @ .., last] = bytes {
87 if last.is_ascii_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii_whitespace().() {
88 bytes = rest;
89 } else {
90 break;
91 }
92 }
93
94 bytes
95 }