sass_alt/
ImportsSassCompilerIterator.rs1pub struct ImportsSassCompilerIterator
7{
8 length: usize,
9 sass_compiler: *mut Sass_Compiler,
10 next_index: usize,
11}
12
13impl Iterator for ImportsSassCompilerIterator
14{
15 type Item = Sass_Import_Entry;
16
17 #[inline(always)]
18 fn next(&mut self) -> Option<Self::Item>
19 {
20 if self.next_index == self.length
21 {
22 None
23 }
24 else
25 {
26 let next = self.sass_compiler.get_import(self.next_index);
27 self.next_index += 1;
28 Some(next)
29 }
30 }
31
32 #[inline(always)]
33 fn size_hint(&self) -> (usize, Option<usize>)
34 {
35 (self.length, Some(self.length))
36 }
37}
38
39impl ExactSizeIterator for ImportsSassCompilerIterator
40{
41 fn len(&self) -> usize
42 {
43 self.length
44 }
45}
46
47impl ImportsSassCompilerIterator
48{
49 #[inline(always)]
50 fn new(sass_compiler: *mut Sass_Compiler) -> Self
51 {
52 Self
53 {
54 length: sass_compiler.get_import_length(),
55 sass_compiler,
56 next_index: 0,
57 }
58 }
59
60 #[inline(always)]
64 pub fn last_import(&self) -> Option<Sass_Import_Entry>
65 {
66 let pointer = self.sass_compiler.get_import_last();
67 if pointer.is_null()
68 {
69 None
70 }
71 else
72 {
73 Some(pointer)
74 }
75 }
76}