Debian Codegraph @

src/segments.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#;
2
3 /// Represents a sequence of segments in a JSON pointer.
4 ///
5 /// Used to track the path during JSON pointer resolution.
6 pub(craterust-analyzer cargo referencing 0.37.4 crate/) struct Segmentsrust-analyzer cargo referencing 0.37.4 segments/Segments#<'a>(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#<'a>>);
7
8 impl<'a> Segmentsrust-analyzer cargo referencing 0.37.4 segments/Segments#<'a> {
9 /// Creates a new, empty `Segments` instance.
10 pub(craterust-analyzer cargo referencing 0.37.4 crate/) fn newrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segments<'a>`]new().() -> Selfrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segments<'a>`] {
11 Selfrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segments<'a>`](Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().())
12 }
13
14 /// Adds a new segment to the sequence.
15 pub(craterust-analyzer cargo referencing 0.37.4 crate/) fn pushrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segments<'a>`]push().(&mut self, segment: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#<'a>>) {
16 self.0rust-analyzer cargo referencing 0.37.4 segments/Segments#0..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(segment.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().());
17 }
18
19 /// Returns an iterator over the segments.
20 pub(craterust-analyzer cargo referencing 0.37.4 crate/) fn iterrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segments<'a>`]iter().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#<'a>> {
21 self.0rust-analyzer cargo referencing 0.37.4 segments/Segments#0..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
22 }
23 }
24
25 /// Represents a single segment in a JSON pointer.
26 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
27 pub(craterust-analyzer cargo referencing 0.37.4 crate/) enum Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#<'a> {
28 /// A string key for object properties.
29 Keyrust-analyzer cargo referencing 0.37.4 segments/Segment#Key#(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, str>),
30 /// A numeric index for array elements.
31 Indexrust-analyzer cargo referencing 0.37.4 segments/Segment#Index#(usize),
32 }
33
34 impl<'a> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, str>> for Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#<'a> {
35 fn fromrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segment<'a>`][`From<Cow<'a, str>>`]from().(value: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, str>) -> Selfrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segment<'a>`][`From<Cow<'a, str>>`] {
36 Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#::Keyrust-analyzer cargo referencing 0.37.4 segments/Segment#Key#(value)
37 }
38 }
39
40 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<usize> for Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#<'_> {
41 fn fromrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segment<'_>`][`From<usize>`]from().(value: usize) -> Selfrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segment<'_>`][`From<usize>`] {
42 Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#::Indexrust-analyzer cargo referencing 0.37.4 segments/Segment#Index#(value)
43 }
44 }