<!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayvec-0.7.4/src/arrayvec.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L178'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::cmp;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::iter;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::mem;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::ops::{Bound, Deref, DerefMut, RangeBounds};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::ptr;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::slice;</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// extra traits</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::borrow::{Borrow, BorrowMut};</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::hash::{Hash, Hasher};</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::fmt;</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature="std")]</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::io;</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::mem::ManuallyDrop;</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::mem::MaybeUninit;</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature="serde")]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use serde::{Serialize, Deserialize, Serializer, Deserializer};</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::LenUint;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::errors::CapacityError;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::arrayvec_impl::ArrayVecImpl;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::utils::MakeMaybeUninit;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A vector with a fixed capacity.</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The `ArrayVec` is a vector backed by a fixed size array. It keeps track of</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the number of initialized elements. The `ArrayVec<T, CAP>` is parameterized</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// by `T` for the element type and `CAP` for the maximum capacity.</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// `CAP` is of type `usize` but is range limited to `u32::MAX`; attempting to create larger</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// arrayvecs with larger capacity will panic.</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The vector is a contiguous value (storing the elements inline) that you can store directly on</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the stack if needed.</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// It offers a simple API but also dereferences to a slice, so that the full slice API is</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// available. The ArrayVec can be converted into a by value iterator.</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct ArrayVec<T, const CAP: usize> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // the `len` first elements of the array are initialized</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> xs: [MaybeUninit<T>; CAP],</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> len: LenUint,</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Drop for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> fn drop(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> self.clear();</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> // MaybeUninit inhibits array's drop</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXNtCskQaAGJdWXwX_8arrayvec8arrayvecINtB2_8ArrayVechKj1000_ENtNtNtCs6xNykbTfrCs_4core3ops4drop4Drop4dropCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn drop(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.clear();</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // MaybeUninit inhibits array's drop</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXNtCskQaAGJdWXwX_8arrayvec8arrayvecINtB2_8ArrayVecjKj10_ENtNtNtCs6xNykbTfrCs_4core3ops4drop4Drop4dropCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn drop(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.clear();</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // MaybeUninit inhibits array's drop</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXNtCskQaAGJdWXwX_8arrayvec8arrayvecINtB2_8ArrayVecjKj80_ENtNtNtCs6xNykbTfrCs_4core3ops4drop4Drop4dropCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>macro_rules! panic_oob {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ($method_name:expr, $index:expr, $len:expr) => {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> panic!(concat!("ArrayVec::", $method_name, ": index {} is out of bounds in vector of length {}"),</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $index, $len)</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Capacity</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const CAPACITY: usize = CAP;</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Create a new empty `ArrayVec`.</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The maximum capacity is given by the generic parameter `CAP`.</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::<_, 16>::new();</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.push(1);</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.push(2);</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[1, 2]);</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.capacity(), 16);</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[track_caller]</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> pub fn new() -> ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> assert_capacity_limit!(CAP);</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> ArrayVec { xs: MaybeUninit::uninit().assume_init(), len: 0 }</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVechKj1000_E3newCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn new() -> ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> assert_capacity_limit!(CAP);</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ArrayVec { xs: MaybeUninit::uninit().assume_init(), len: 0 }</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVecjKj10_E3newCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn new() -> ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> assert_capacity_limit!(CAP);</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ArrayVec { xs: MaybeUninit::uninit().assume_init(), len: 0 }</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVecjKj80_E3newCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Create a new empty `ArrayVec` (const fn).</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The maximum capacity is given by the generic parameter `CAP`.</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// static ARRAY: ArrayVec<u8, 1024> = ArrayVec::new_const();</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub const fn new_const() -> ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_capacity_limit_const!(CAP);</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayVec { xs: MakeMaybeUninit::ARRAY, len: 0 }</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return the number of elements in the `ArrayVec`.</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.pop();</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.len(), 2);</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='covered-line'><pre>30.5k</pre></td><td class='code'><pre> pub const fn len(&self) -> usize { self.len as usize }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVechKj1000_E3lenCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> pub const fn len(&self) -> usize { self.len as usize }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVecjKj10_E3lenCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub const fn len(&self) -> usize { self.len as usize }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVecjKj80_E3lenCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns whether the `ArrayVec` is empty.</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1]);</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.pop();</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.is_empty(), true);</pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub const fn is_empty(&self) -> bool { self.len() == 0 }</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return the capacity of the `ArrayVec`.</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.capacity(), 3);</pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='covered-line'><pre>2.29k</pre></td><td class='code'><pre> pub const fn capacity(&self) -> usize { CAP }</pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return true if the `ArrayVec` is completely filled to its capacity, false otherwise.</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::<_, 1>::new();</pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(!array.is_full());</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.push(1);</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(array.is_full());</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub const fn is_full(&self) -> bool { self.len() == self.capacity() }</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns the capacity left in the `ArrayVec`.</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.pop();</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.remaining_capacity(), 1);</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> pub const fn remaining_capacity(&self) -> usize {</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> self.capacity() - self.len()</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Push `element` to the end of the vector.</pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ***Panics*** if the vector is already full.</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::<_, 2>::new();</pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.push(1);</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.push(2);</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[1, 2]);</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[track_caller]</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn push(&mut self, element: T) {</span></pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ArrayVecImpl::push(self, element)</span></pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Push `element` to the end of the vector.</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return `Ok` if the push succeeds, or return an error if the vector</pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// is already full.</pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::<_, 2>::new();</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let push1 = array.try_push(1);</pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let push2 = array.try_push(2);</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(push1.is_ok());</pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(push2.is_ok());</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[1, 2]);</pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let overflow = array.try_push(3);</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(overflow.is_err());</pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn try_push(&mut self, element: T) -> Result<(), CapacityError<T>> {</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayVecImpl::try_push(self, element)</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Push `element` to the end of the vector without checking the capacity.</pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// It is up to the caller to ensure the capacity of the vector is</pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// sufficiently large.</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method uses *debug assertions* to check that the arrayvec is not full.</pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::<_, 2>::new();</pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// if array.len() + 2 <= array.capacity() {</pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// unsafe {</pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.push_unchecked(1);</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.push_unchecked(2);</pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// }</pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// }</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[1, 2]);</pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub unsafe fn push_unchecked(&mut self, element: T) {</pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayVecImpl::push_unchecked(self, element)</pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Shortens the vector, keeping the first `len` elements and dropping</pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the rest.</pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If `len` is greater than the vector’s current length this has no</pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// effect.</pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1, 2, 3, 4, 5]);</pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.truncate(3);</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.truncate(4);</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn truncate(&mut self, new_len: usize) {</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayVecImpl::truncate(self, new_len)</pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Remove all elements in the vector.</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> pub fn clear(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> ArrayVecImpl::clear(self)</pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVechKj1000_E5clearCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn clear(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ArrayVecImpl::clear(self)</pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVecjKj10_E5clearCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn clear(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ArrayVecImpl::clear(self)</pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVecjKj80_E5clearCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Get pointer to where element at `index` would be</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> unsafe fn get_unchecked_ptr(&mut self, index: usize) -> *mut T {</pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> self.as_mut_ptr().add(index)</pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Insert `element` at position `index`.</pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Shift up all elements after `index`.</pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// It is an error if the index is greater than the length or if the</pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// arrayvec is full.</pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ***Panics*** if the array is full or the `index` is out of bounds. See</pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// `try_insert` for fallible version.</pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::<_, 2>::new();</pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.insert(0, "x");</pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.insert(0, "y");</pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &["y", "x"]);</pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[track_caller]</pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn insert(&mut self, index: usize, element: T) {</pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.try_insert(index, element).unwrap()</pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Insert `element` at position `index`.</pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Shift up all elements after `index`; the `index` must be less than</pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// or equal to the length.</pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns an error if vector is already at full capacity.</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ***Panics*** `index` is out of bounds.</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::<_, 2>::new();</pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(array.try_insert(0, "x").is_ok());</pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(array.try_insert(0, "y").is_ok());</pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(array.try_insert(0, "z").is_err());</pre></td></tr><tr><td class='line-number'><a name='L305' href='#L305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &["y", "x"]);</pre></td></tr><tr><td class='line-number'><a name='L306' href='#L306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L307' href='#L307'><pre>307</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L308' href='#L308'><pre>308</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn try_insert(&mut self, index: usize, element: T) -> Result<(), CapacityError<T>> {</pre></td></tr><tr><td class='line-number'><a name='L309' href='#L309'><pre>309</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if index > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L310' href='#L310'><pre>310</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> panic_oob!("try_insert", index, self.len())</pre></td></tr><tr><td class='line-number'><a name='L311' href='#L311'><pre>311</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L312' href='#L312'><pre>312</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if self.len() == self.capacity() {</pre></td></tr><tr><td class='line-number'><a name='L313' href='#L313'><pre>313</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(CapacityError::new(element));</pre></td></tr><tr><td class='line-number'><a name='L314' href='#L314'><pre>314</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L315' href='#L315'><pre>315</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L316' href='#L316'><pre>316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L317' href='#L317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // follows is just like Vec<T></pre></td></tr><tr><td class='line-number'><a name='L318' href='#L318'><pre>318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe { // infallible</pre></td></tr><tr><td class='line-number'><a name='L319' href='#L319'><pre>319</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // The spot to put the new value</pre></td></tr><tr><td class='line-number'><a name='L320' href='#L320'><pre>320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L321' href='#L321'><pre>321</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let p: *mut _ = self.get_unchecked_ptr(index);</pre></td></tr><tr><td class='line-number'><a name='L322' href='#L322'><pre>322</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Shift everything over to make space. (Duplicating the</pre></td></tr><tr><td class='line-number'><a name='L323' href='#L323'><pre>323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `index`th element into two consecutive places.)</pre></td></tr><tr><td class='line-number'><a name='L324' href='#L324'><pre>324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr::copy(p, p.offset(1), len - index);</pre></td></tr><tr><td class='line-number'><a name='L325' href='#L325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write it in, overwriting the first copy of the `index`th</pre></td></tr><tr><td class='line-number'><a name='L326' href='#L326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // element.</pre></td></tr><tr><td class='line-number'><a name='L327' href='#L327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr::write(p, element);</pre></td></tr><tr><td class='line-number'><a name='L328' href='#L328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L329' href='#L329'><pre>329</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.set_len(len + 1);</pre></td></tr><tr><td class='line-number'><a name='L330' href='#L330'><pre>330</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L331' href='#L331'><pre>331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L332' href='#L332'><pre>332</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L333' href='#L333'><pre>333</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L334' href='#L334'><pre>334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Remove the last element in the vector and return it.</pre></td></tr><tr><td class='line-number'><a name='L335' href='#L335'><pre>335</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L336' href='#L336'><pre>336</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return `Some(` *element* `)` if the vector is non-empty, else `None`.</pre></td></tr><tr><td class='line-number'><a name='L337' href='#L337'><pre>337</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L338' href='#L338'><pre>338</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L339' href='#L339'><pre>339</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L340' href='#L340'><pre>340</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L341' href='#L341'><pre>341</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::<_, 2>::new();</pre></td></tr><tr><td class='line-number'><a name='L342' href='#L342'><pre>342</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L343' href='#L343'><pre>343</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.push(1);</pre></td></tr><tr><td class='line-number'><a name='L344' href='#L344'><pre>344</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L345' href='#L345'><pre>345</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.pop(), Some(1));</pre></td></tr><tr><td class='line-number'><a name='L346' href='#L346'><pre>346</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.pop(), None);</pre></td></tr><tr><td class='line-number'><a name='L347' href='#L347'><pre>347</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L348' href='#L348'><pre>348</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn pop(&mut self) -> Option<T> {</pre></td></tr><tr><td class='line-number'><a name='L349' href='#L349'><pre>349</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayVecImpl::pop(self)</pre></td></tr><tr><td class='line-number'><a name='L350' href='#L350'><pre>350</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L351' href='#L351'><pre>351</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L352' href='#L352'><pre>352</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Remove the element at `index` and swap the last element into its place.</pre></td></tr><tr><td class='line-number'><a name='L353' href='#L353'><pre>353</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L354' href='#L354'><pre>354</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This operation is O(1).</pre></td></tr><tr><td class='line-number'><a name='L355' href='#L355'><pre>355</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L356' href='#L356'><pre>356</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return the *element* if the index is in bounds, else panic.</pre></td></tr><tr><td class='line-number'><a name='L357' href='#L357'><pre>357</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L358' href='#L358'><pre>358</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ***Panics*** if the `index` is out of bounds.</pre></td></tr><tr><td class='line-number'><a name='L359' href='#L359'><pre>359</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L360' href='#L360'><pre>360</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L361' href='#L361'><pre>361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L362' href='#L362'><pre>362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L363' href='#L363'><pre>363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L364' href='#L364'><pre>364</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L365' href='#L365'><pre>365</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.swap_remove(0), 1);</pre></td></tr><tr><td class='line-number'><a name='L366' href='#L366'><pre>366</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[3, 2]);</pre></td></tr><tr><td class='line-number'><a name='L367' href='#L367'><pre>367</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L368' href='#L368'><pre>368</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.swap_remove(1), 2);</pre></td></tr><tr><td class='line-number'><a name='L369' href='#L369'><pre>369</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[3]);</pre></td></tr><tr><td class='line-number'><a name='L370' href='#L370'><pre>370</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L371' href='#L371'><pre>371</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn swap_remove(&mut self, index: usize) -> T {</pre></td></tr><tr><td class='line-number'><a name='L372' href='#L372'><pre>372</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.swap_pop(index)</pre></td></tr><tr><td class='line-number'><a name='L373' href='#L373'><pre>373</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> .unwrap_or_else(|| {</pre></td></tr><tr><td class='line-number'><a name='L374' href='#L374'><pre>374</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> panic_oob!("swap_remove", index, self.len())</pre></td></tr><tr><td class='line-number'><a name='L375' href='#L375'><pre>375</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L376' href='#L376'><pre>376</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L377' href='#L377'><pre>377</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L378' href='#L378'><pre>378</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Remove the element at `index` and swap the last element into its place.</pre></td></tr><tr><td class='line-number'><a name='L379' href='#L379'><pre>379</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L380' href='#L380'><pre>380</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This is a checked version of `.swap_remove`. </pre></td></tr><tr><td class='line-number'><a name='L381' href='#L381'><pre>381</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This operation is O(1).</pre></td></tr><tr><td class='line-number'><a name='L382' href='#L382'><pre>382</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L383' href='#L383'><pre>383</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return `Some(` *element* `)` if the index is in bounds, else `None`.</pre></td></tr><tr><td class='line-number'><a name='L384' href='#L384'><pre>384</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L385' href='#L385'><pre>385</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L386' href='#L386'><pre>386</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L387' href='#L387'><pre>387</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L388' href='#L388'><pre>388</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L389' href='#L389'><pre>389</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L390' href='#L390'><pre>390</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.swap_pop(0), Some(1));</pre></td></tr><tr><td class='line-number'><a name='L391' href='#L391'><pre>391</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[3, 2]);</pre></td></tr><tr><td class='line-number'><a name='L392' href='#L392'><pre>392</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L393' href='#L393'><pre>393</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(array.swap_pop(10), None);</pre></td></tr><tr><td class='line-number'><a name='L394' href='#L394'><pre>394</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L395' href='#L395'><pre>395</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn swap_pop(&mut self, index: usize) -> Option<T> {</pre></td></tr><tr><td class='line-number'><a name='L396' href='#L396'><pre>396</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L397' href='#L397'><pre>397</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if index >= len {</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.swap(index, len - 1);</pre></td></tr><tr><td class='line-number'><a name='L401' href='#L401'><pre>401</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.pop()</pre></td></tr><tr><td class='line-number'><a name='L402' href='#L402'><pre>402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L403' href='#L403'><pre>403</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L404' href='#L404'><pre>404</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Remove the element at `index` and shift down the following elements.</pre></td></tr><tr><td class='line-number'><a name='L405' href='#L405'><pre>405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L406' href='#L406'><pre>406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The `index` must be strictly less than the length of the vector.</pre></td></tr><tr><td class='line-number'><a name='L407' href='#L407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L408' href='#L408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ***Panics*** if the `index` is out of bounds.</pre></td></tr><tr><td class='line-number'><a name='L409' href='#L409'><pre>409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L410' href='#L410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L411' href='#L411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L412' href='#L412'><pre>412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L413' href='#L413'><pre>413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L414' href='#L414'><pre>414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L415' href='#L415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let removed_elt = array.remove(0);</pre></td></tr><tr><td class='line-number'><a name='L416' href='#L416'><pre>416</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(removed_elt, 1);</pre></td></tr><tr><td class='line-number'><a name='L417' href='#L417'><pre>417</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L418' href='#L418'><pre>418</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L419' href='#L419'><pre>419</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn remove(&mut self, index: usize) -> T {</pre></td></tr><tr><td class='line-number'><a name='L420' href='#L420'><pre>420</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.pop_at(index)</pre></td></tr><tr><td class='line-number'><a name='L421' href='#L421'><pre>421</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> .unwrap_or_else(|| {</pre></td></tr><tr><td class='line-number'><a name='L422' href='#L422'><pre>422</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> panic_oob!("remove", index, self.len())</pre></td></tr><tr><td class='line-number'><a name='L423' href='#L423'><pre>423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L424' href='#L424'><pre>424</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Remove the element at `index` and shift down the following elements.</pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This is a checked version of `.remove(index)`. Returns `None` if there</pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// is no element at `index`. Otherwise, return the element inside `Some`.</pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L434' href='#L434'><pre>434</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L435' href='#L435'><pre>435</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L436' href='#L436'><pre>436</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(array.pop_at(0).is_some());</pre></td></tr><tr><td class='line-number'><a name='L437' href='#L437'><pre>437</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L438' href='#L438'><pre>438</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L439' href='#L439'><pre>439</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(array.pop_at(2).is_none());</pre></td></tr><tr><td class='line-number'><a name='L440' href='#L440'><pre>440</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(array.pop_at(10).is_none());</pre></td></tr><tr><td class='line-number'><a name='L441' href='#L441'><pre>441</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L442' href='#L442'><pre>442</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn pop_at(&mut self, index: usize) -> Option<T> {</pre></td></tr><tr><td class='line-number'><a name='L443' href='#L443'><pre>443</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if index >= self.len() {</pre></td></tr><tr><td class='line-number'><a name='L444' href='#L444'><pre>444</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> None</pre></td></tr><tr><td class='line-number'><a name='L445' href='#L445'><pre>445</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L446' href='#L446'><pre>446</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.drain(index..index + 1).next()</pre></td></tr><tr><td class='line-number'><a name='L447' href='#L447'><pre>447</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L448' href='#L448'><pre>448</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L449' href='#L449'><pre>449</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L450' href='#L450'><pre>450</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Retains only the elements specified by the predicate.</pre></td></tr><tr><td class='line-number'><a name='L451' href='#L451'><pre>451</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L452' href='#L452'><pre>452</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// In other words, remove all elements `e` such that `f(&mut e)` returns false.</pre></td></tr><tr><td class='line-number'><a name='L453' href='#L453'><pre>453</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method operates in place and preserves the order of the retained</pre></td></tr><tr><td class='line-number'><a name='L454' href='#L454'><pre>454</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// elements.</pre></td></tr><tr><td class='line-number'><a name='L455' href='#L455'><pre>455</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L456' href='#L456'><pre>456</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L457' href='#L457'><pre>457</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L458' href='#L458'><pre>458</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L459' href='#L459'><pre>459</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut array = ArrayVec::from([1, 2, 3, 4]);</pre></td></tr><tr><td class='line-number'><a name='L460' href='#L460'><pre>460</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// array.retain(|x| *x & 1 != 0 );</pre></td></tr><tr><td class='line-number'><a name='L461' href='#L461'><pre>461</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&array[..], &[1, 3]);</pre></td></tr><tr><td class='line-number'><a name='L462' href='#L462'><pre>462</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L463' href='#L463'><pre>463</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn retain<F>(&mut self, mut f: F)</pre></td></tr><tr><td class='line-number'><a name='L464' href='#L464'><pre>464</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where F: FnMut(&mut T) -> bool</pre></td></tr><tr><td class='line-number'><a name='L465' href='#L465'><pre>465</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L466' href='#L466'><pre>466</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Check the implementation of</pre></td></tr><tr><td class='line-number'><a name='L467' href='#L467'><pre>467</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // https://doc.rust-lang.org/std/vec/struct.Vec.html#method.retain</pre></td></tr><tr><td class='line-number'><a name='L468' href='#L468'><pre>468</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // for safety arguments (especially regarding panics in f and when</pre></td></tr><tr><td class='line-number'><a name='L469' href='#L469'><pre>469</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // dropping elements). Implementation closely mirrored here.</pre></td></tr><tr><td class='line-number'><a name='L470' href='#L470'><pre>470</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L471' href='#L471'><pre>471</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let original_len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L472' href='#L472'><pre>472</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe { self.set_len(0) };</pre></td></tr><tr><td class='line-number'><a name='L473' href='#L473'><pre>473</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L474' href='#L474'><pre>474</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> struct BackshiftOnDrop<'a, T, const CAP: usize> {</pre></td></tr><tr><td class='line-number'><a name='L475' href='#L475'><pre>475</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> v: &'a mut ArrayVec<T, CAP>,</pre></td></tr><tr><td class='line-number'><a name='L476' href='#L476'><pre>476</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> processed_len: usize,</pre></td></tr><tr><td class='line-number'><a name='L477' href='#L477'><pre>477</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> deleted_cnt: usize,</pre></td></tr><tr><td class='line-number'><a name='L478' href='#L478'><pre>478</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> original_len: usize,</pre></td></tr><tr><td class='line-number'><a name='L479' href='#L479'><pre>479</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L480' href='#L480'><pre>480</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L481' href='#L481'><pre>481</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, const CAP: usize> Drop for BackshiftOnDrop<'_, T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L482' href='#L482'><pre>482</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn drop(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L483' href='#L483'><pre>483</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if self.deleted_cnt > 0 {</pre></td></tr><tr><td class='line-number'><a name='L484' href='#L484'><pre>484</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L485' href='#L485'><pre>485</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr::copy(</pre></td></tr><tr><td class='line-number'><a name='L486' href='#L486'><pre>486</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.v.as_ptr().add(self.processed_len),</pre></td></tr><tr><td class='line-number'><a name='L487' href='#L487'><pre>487</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.v.as_mut_ptr().add(self.processed_len - self.deleted_cnt),</pre></td></tr><tr><td class='line-number'><a name='L488' href='#L488'><pre>488</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.original_len - self.processed_len</pre></td></tr><tr><td class='line-number'><a name='L489' href='#L489'><pre>489</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L490' href='#L490'><pre>490</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L491' href='#L491'><pre>491</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L492' href='#L492'><pre>492</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L493' href='#L493'><pre>493</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.v.set_len(self.original_len - self.deleted_cnt);</pre></td></tr><tr><td class='line-number'><a name='L494' href='#L494'><pre>494</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L495' href='#L495'><pre>495</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L496' href='#L496'><pre>496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L497' href='#L497'><pre>497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L498' href='#L498'><pre>498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut g = BackshiftOnDrop { v: self, processed_len: 0, deleted_cnt: 0, original_len };</pre></td></tr><tr><td class='line-number'><a name='L499' href='#L499'><pre>499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L500' href='#L500'><pre>500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L501' href='#L501'><pre>501</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn process_one<F: FnMut(&mut T) -> bool, T, const CAP: usize, const DELETED: bool>(</pre></td></tr><tr><td class='line-number'><a name='L502' href='#L502'><pre>502</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> f: &mut F,</pre></td></tr><tr><td class='line-number'><a name='L503' href='#L503'><pre>503</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> g: &mut BackshiftOnDrop<'_, T, CAP></pre></td></tr><tr><td class='line-number'><a name='L504' href='#L504'><pre>504</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L505' href='#L505'><pre>505</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let cur = unsafe { g.v.as_mut_ptr().add(g.processed_len) };</pre></td></tr><tr><td class='line-number'><a name='L506' href='#L506'><pre>506</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if !f(unsafe { &mut *cur }) {</pre></td></tr><tr><td class='line-number'><a name='L507' href='#L507'><pre>507</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> g.processed_len += 1;</pre></td></tr><tr><td class='line-number'><a name='L508' href='#L508'><pre>508</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> g.deleted_cnt += 1;</pre></td></tr><tr><td class='line-number'><a name='L509' href='#L509'><pre>509</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe { ptr::drop_in_place(cur) };</pre></td></tr><tr><td class='line-number'><a name='L510' href='#L510'><pre>510</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L511' href='#L511'><pre>511</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L512' href='#L512'><pre>512</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if DELETED {</pre></td></tr><tr><td class='line-number'><a name='L513' href='#L513'><pre>513</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L514' href='#L514'><pre>514</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let hole_slot = cur.sub(g.deleted_cnt);</pre></td></tr><tr><td class='line-number'><a name='L515' href='#L515'><pre>515</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr::copy_nonoverlapping(cur, hole_slot, 1);</pre></td></tr><tr><td class='line-number'><a name='L516' href='#L516'><pre>516</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L517' href='#L517'><pre>517</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L518' href='#L518'><pre>518</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> g.processed_len += 1;</pre></td></tr><tr><td class='line-number'><a name='L519' href='#L519'><pre>519</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> true</pre></td></tr><tr><td class='line-number'><a name='L520' href='#L520'><pre>520</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L521' href='#L521'><pre>521</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L522' href='#L522'><pre>522</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Stage 1: Nothing was deleted.</pre></td></tr><tr><td class='line-number'><a name='L523' href='#L523'><pre>523</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> while g.processed_len != original_len {</pre></td></tr><tr><td class='line-number'><a name='L524' href='#L524'><pre>524</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if !process_one::<F, T, CAP, false>(&mut f, &mut g) {</pre></td></tr><tr><td class='line-number'><a name='L525' href='#L525'><pre>525</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L526' href='#L526'><pre>526</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L527' href='#L527'><pre>527</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L528' href='#L528'><pre>528</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L529' href='#L529'><pre>529</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Stage 2: Some elements were deleted.</pre></td></tr><tr><td class='line-number'><a name='L530' href='#L530'><pre>530</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> while g.processed_len != original_len {</pre></td></tr><tr><td class='line-number'><a name='L531' href='#L531'><pre>531</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> process_one::<F, T, CAP, true>(&mut f, &mut g);</pre></td></tr><tr><td class='line-number'><a name='L532' href='#L532'><pre>532</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L533' href='#L533'><pre>533</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L534' href='#L534'><pre>534</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> drop(g);</pre></td></tr><tr><td class='line-number'><a name='L535' href='#L535'><pre>535</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L536' href='#L536'><pre>536</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L537' href='#L537'><pre>537</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Set the vector’s length without dropping or moving out elements</pre></td></tr><tr><td class='line-number'><a name='L538' href='#L538'><pre>538</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L539' href='#L539'><pre>539</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method is `unsafe` because it changes the notion of the</pre></td></tr><tr><td class='line-number'><a name='L540' href='#L540'><pre>540</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// number of “valid†elements in the vector. Use with care.</pre></td></tr><tr><td class='line-number'><a name='L541' href='#L541'><pre>541</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L542' href='#L542'><pre>542</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method uses *debug assertions* to check that `length` is</pre></td></tr><tr><td class='line-number'><a name='L543' href='#L543'><pre>543</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// not greater than the capacity.</pre></td></tr><tr><td class='line-number'><a name='L544' href='#L544'><pre>544</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> pub unsafe fn set_len(&mut self, length: usize) {</pre></td></tr><tr><td class='line-number'><a name='L545' href='#L545'><pre>545</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // type invariant that capacity always fits in LenUint</pre></td></tr><tr><td class='line-number'><a name='L546' href='#L546'><pre>546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> debug_assert!(<span class='red'>length <= self.capacity()</span>);</pre></td></tr><tr><td class='line-number'><a name='L547' href='#L547'><pre>547</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> self.len = length as LenUint;</pre></td></tr><tr><td class='line-number'><a name='L548' href='#L548'><pre>548</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L549' href='#L549'><pre>549</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L550' href='#L550'><pre>550</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Copy all elements from the slice and append to the `ArrayVec`.</pre></td></tr><tr><td class='line-number'><a name='L551' href='#L551'><pre>551</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L552' href='#L552'><pre>552</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L553' href='#L553'><pre>553</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L554' href='#L554'><pre>554</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L555' href='#L555'><pre>555</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut vec: ArrayVec<usize, 10> = ArrayVec::new();</pre></td></tr><tr><td class='line-number'><a name='L556' href='#L556'><pre>556</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// vec.push(1);</pre></td></tr><tr><td class='line-number'><a name='L557' href='#L557'><pre>557</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// vec.try_extend_from_slice(&[2, 3]).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L558' href='#L558'><pre>558</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&vec[..], &[1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L559' href='#L559'><pre>559</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L560' href='#L560'><pre>560</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L561' href='#L561'><pre>561</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Errors</pre></td></tr><tr><td class='line-number'><a name='L562' href='#L562'><pre>562</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L563' href='#L563'><pre>563</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method will return an error if the capacity left (see</pre></td></tr><tr><td class='line-number'><a name='L564' href='#L564'><pre>564</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// [`remaining_capacity`]) is smaller then the length of the provided</pre></td></tr><tr><td class='line-number'><a name='L565' href='#L565'><pre>565</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// slice.</pre></td></tr><tr><td class='line-number'><a name='L566' href='#L566'><pre>566</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L567' href='#L567'><pre>567</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// [`remaining_capacity`]: #method.remaining_capacity</pre></td></tr><tr><td class='line-number'><a name='L568' href='#L568'><pre>568</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> pub fn try_extend_from_slice(&mut self, other: &[T]) -> Result<(), CapacityError></pre></td></tr><tr><td class='line-number'><a name='L569' href='#L569'><pre>569</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> where T: Copy,</pre></td></tr><tr><td class='line-number'><a name='L570' href='#L570'><pre>570</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L571' href='#L571'><pre>571</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> if self.remaining_capacity() < other.len() {</pre></td></tr><tr><td class='line-number'><a name='L572' href='#L572'><pre>572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(CapacityError::new(()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L573' href='#L573'><pre>573</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L574' href='#L574'><pre>574</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L575' href='#L575'><pre>575</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> let self_len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L576' href='#L576'><pre>576</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> let other_len = other.len();</pre></td></tr><tr><td class='line-number'><a name='L577' href='#L577'><pre>577</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L578' href='#L578'><pre>578</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L579' href='#L579'><pre>579</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> let dst = self.get_unchecked_ptr(self_len);</pre></td></tr><tr><td class='line-number'><a name='L580' href='#L580'><pre>580</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> ptr::copy_nonoverlapping(other.as_ptr(), dst, other_len);</pre></td></tr><tr><td class='line-number'><a name='L581' href='#L581'><pre>581</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> self.set_len(self_len + other_len);</pre></td></tr><tr><td class='line-number'><a name='L582' href='#L582'><pre>582</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L583' href='#L583'><pre>583</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L584' href='#L584'><pre>584</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L585' href='#L585'><pre>585</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L586' href='#L586'><pre>586</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Create a draining iterator that removes the specified range in the vector</pre></td></tr><tr><td class='line-number'><a name='L587' href='#L587'><pre>587</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// and yields the removed items from start to end. The element range is</pre></td></tr><tr><td class='line-number'><a name='L588' href='#L588'><pre>588</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// removed even if the iterator is not consumed until the end.</pre></td></tr><tr><td class='line-number'><a name='L589' href='#L589'><pre>589</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L590' href='#L590'><pre>590</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Note: It is unspecified how many elements are removed from the vector,</pre></td></tr><tr><td class='line-number'><a name='L591' href='#L591'><pre>591</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// if the `Drain` value is leaked.</pre></td></tr><tr><td class='line-number'><a name='L592' href='#L592'><pre>592</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L593' href='#L593'><pre>593</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// **Panics** if the starting point is greater than the end point or if</pre></td></tr><tr><td class='line-number'><a name='L594' href='#L594'><pre>594</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the end point is greater than the length of the vector.</pre></td></tr><tr><td class='line-number'><a name='L595' href='#L595'><pre>595</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L596' href='#L596'><pre>596</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L597' href='#L597'><pre>597</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L598' href='#L598'><pre>598</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L599' href='#L599'><pre>599</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut v1 = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L600' href='#L600'><pre>600</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let v2: ArrayVec<_, 3> = v1.drain(0..2).collect();</pre></td></tr><tr><td class='line-number'><a name='L601' href='#L601'><pre>601</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&v1[..], &[3]);</pre></td></tr><tr><td class='line-number'><a name='L602' href='#L602'><pre>602</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&v2[..], &[1, 2]);</pre></td></tr><tr><td class='line-number'><a name='L603' href='#L603'><pre>603</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L604' href='#L604'><pre>604</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn drain<R>(&mut self, range: R) -> Drain<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L605' href='#L605'><pre>605</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where R: RangeBounds<usize></pre></td></tr><tr><td class='line-number'><a name='L606' href='#L606'><pre>606</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L607' href='#L607'><pre>607</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Memory safety</pre></td></tr><tr><td class='line-number'><a name='L608' href='#L608'><pre>608</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L609' href='#L609'><pre>609</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // When the Drain is first created, it shortens the length of</pre></td></tr><tr><td class='line-number'><a name='L610' href='#L610'><pre>610</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // the source vector to make sure no uninitialized or moved-from elements</pre></td></tr><tr><td class='line-number'><a name='L611' href='#L611'><pre>611</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // are accessible at all if the Drain's destructor never gets to run.</pre></td></tr><tr><td class='line-number'><a name='L612' href='#L612'><pre>612</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L613' href='#L613'><pre>613</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Drain will ptr::read out the values to remove.</pre></td></tr><tr><td class='line-number'><a name='L614' href='#L614'><pre>614</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // When finished, remaining tail of the vec is copied back to cover</pre></td></tr><tr><td class='line-number'><a name='L615' href='#L615'><pre>615</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // the hole, and the vector length is restored to the new length.</pre></td></tr><tr><td class='line-number'><a name='L616' href='#L616'><pre>616</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L617' href='#L617'><pre>617</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L618' href='#L618'><pre>618</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let start = match range.start_bound() {</pre></td></tr><tr><td class='line-number'><a name='L619' href='#L619'><pre>619</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Bound::Unbounded => 0,</pre></td></tr><tr><td class='line-number'><a name='L620' href='#L620'><pre>620</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Bound::Included(&i) => i,</pre></td></tr><tr><td class='line-number'><a name='L621' href='#L621'><pre>621</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Bound::Excluded(&i) => i.saturating_add(1),</pre></td></tr><tr><td class='line-number'><a name='L622' href='#L622'><pre>622</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L623' href='#L623'><pre>623</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let end = match range.end_bound() {</pre></td></tr><tr><td class='line-number'><a name='L624' href='#L624'><pre>624</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Bound::Excluded(&j) => j,</pre></td></tr><tr><td class='line-number'><a name='L625' href='#L625'><pre>625</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Bound::Included(&j) => j.saturating_add(1),</pre></td></tr><tr><td class='line-number'><a name='L626' href='#L626'><pre>626</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Bound::Unbounded => len,</pre></td></tr><tr><td class='line-number'><a name='L627' href='#L627'><pre>627</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L628' href='#L628'><pre>628</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.drain_range(start, end)</pre></td></tr><tr><td class='line-number'><a name='L629' href='#L629'><pre>629</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L630' href='#L630'><pre>630</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L631' href='#L631'><pre>631</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn drain_range(&mut self, start: usize, end: usize) -> Drain<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L632' href='#L632'><pre>632</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L633' href='#L633'><pre>633</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L634' href='#L634'><pre>634</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L635' href='#L635'><pre>635</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // bounds check happens here (before length is changed!)</pre></td></tr><tr><td class='line-number'><a name='L636' href='#L636'><pre>636</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let range_slice: *const _ = &self[start..end];</pre></td></tr><tr><td class='line-number'><a name='L637' href='#L637'><pre>637</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L638' href='#L638'><pre>638</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Calling `set_len` creates a fresh and thus unique mutable references, making all</pre></td></tr><tr><td class='line-number'><a name='L639' href='#L639'><pre>639</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // older aliases we created invalid. So we cannot call that function.</pre></td></tr><tr><td class='line-number'><a name='L640' href='#L640'><pre>640</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.len = start as LenUint;</pre></td></tr><tr><td class='line-number'><a name='L641' href='#L641'><pre>641</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L642' href='#L642'><pre>642</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L643' href='#L643'><pre>643</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Drain {</pre></td></tr><tr><td class='line-number'><a name='L644' href='#L644'><pre>644</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> tail_start: end,</pre></td></tr><tr><td class='line-number'><a name='L645' href='#L645'><pre>645</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> tail_len: len - end,</pre></td></tr><tr><td class='line-number'><a name='L646' href='#L646'><pre>646</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> iter: (*range_slice).iter(),</pre></td></tr><tr><td class='line-number'><a name='L647' href='#L647'><pre>647</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> vec: self as *mut _,</pre></td></tr><tr><td class='line-number'><a name='L648' href='#L648'><pre>648</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L649' href='#L649'><pre>649</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L650' href='#L650'><pre>650</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L651' href='#L651'><pre>651</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L652' href='#L652'><pre>652</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return the inner fixed size array, if it is full to its capacity.</pre></td></tr><tr><td class='line-number'><a name='L653' href='#L653'><pre>653</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L654' href='#L654'><pre>654</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return an `Ok` value with the array if length equals capacity,</pre></td></tr><tr><td class='line-number'><a name='L655' href='#L655'><pre>655</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// return an `Err` with self otherwise.</pre></td></tr><tr><td class='line-number'><a name='L656' href='#L656'><pre>656</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn into_inner(self) -> Result<[T; CAP], Self> {</pre></td></tr><tr><td class='line-number'><a name='L657' href='#L657'><pre>657</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if self.len() < self.capacity() {</pre></td></tr><tr><td class='line-number'><a name='L658' href='#L658'><pre>658</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Err(self)</pre></td></tr><tr><td class='line-number'><a name='L659' href='#L659'><pre>659</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L660' href='#L660'><pre>660</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe { Ok(self.into_inner_unchecked()) }</pre></td></tr><tr><td class='line-number'><a name='L661' href='#L661'><pre>661</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L662' href='#L662'><pre>662</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L663' href='#L663'><pre>663</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L664' href='#L664'><pre>664</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return the inner fixed size array.</pre></td></tr><tr><td class='line-number'><a name='L665' href='#L665'><pre>665</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L666' href='#L666'><pre>666</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Safety:</pre></td></tr><tr><td class='line-number'><a name='L667' href='#L667'><pre>667</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This operation is safe if and only if length equals capacity.</pre></td></tr><tr><td class='line-number'><a name='L668' href='#L668'><pre>668</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub unsafe fn into_inner_unchecked(self) -> [T; CAP] {</pre></td></tr><tr><td class='line-number'><a name='L669' href='#L669'><pre>669</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> debug_assert_eq!(self.len(), self.capacity());</pre></td></tr><tr><td class='line-number'><a name='L670' href='#L670'><pre>670</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let self_ = ManuallyDrop::new(self);</pre></td></tr><tr><td class='line-number'><a name='L671' href='#L671'><pre>671</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let array = ptr::read(self_.as_ptr() as *const [T; CAP]);</pre></td></tr><tr><td class='line-number'><a name='L672' href='#L672'><pre>672</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> array</pre></td></tr><tr><td class='line-number'><a name='L673' href='#L673'><pre>673</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L674' href='#L674'><pre>674</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L675' href='#L675'><pre>675</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns the ArrayVec, replacing the original with a new empty ArrayVec.</pre></td></tr><tr><td class='line-number'><a name='L676' href='#L676'><pre>676</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L677' href='#L677'><pre>677</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L678' href='#L678'><pre>678</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L679' href='#L679'><pre>679</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L680' href='#L680'><pre>680</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut v = ArrayVec::from([0, 1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L681' href='#L681'><pre>681</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!([0, 1, 2, 3], v.take().into_inner().unwrap());</pre></td></tr><tr><td class='line-number'><a name='L682' href='#L682'><pre>682</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(v.is_empty());</pre></td></tr><tr><td class='line-number'><a name='L683' href='#L683'><pre>683</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L684' href='#L684'><pre>684</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn take(&mut self) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L685' href='#L685'><pre>685</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mem::replace(self, Self::new())</pre></td></tr><tr><td class='line-number'><a name='L686' href='#L686'><pre>686</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L687' href='#L687'><pre>687</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L688' href='#L688'><pre>688</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return a slice containing all elements of the vector.</pre></td></tr><tr><td class='line-number'><a name='L689' href='#L689'><pre>689</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> pub fn as_slice(&self) -> &[T] {</pre></td></tr><tr><td class='line-number'><a name='L690' href='#L690'><pre>690</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> ArrayVecImpl::as_slice(self)</pre></td></tr><tr><td class='line-number'><a name='L691' href='#L691'><pre>691</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVechKj1000_E8as_sliceCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L689' href='#L689'><pre>689</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> pub fn as_slice(&self) -> &[T] {</pre></td></tr><tr><td class='line-number'><a name='L690' href='#L690'><pre>690</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> ArrayVecImpl::as_slice(self)</pre></td></tr><tr><td class='line-number'><a name='L691' href='#L691'><pre>691</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB4_8ArrayVecjKj80_E8as_sliceCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L692' href='#L692'><pre>692</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L693' href='#L693'><pre>693</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return a mutable slice containing all elements of the vector.</pre></td></tr><tr><td class='line-number'><a name='L694' href='#L694'><pre>694</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn as_mut_slice(&mut self) -> &mut [T] {</pre></td></tr><tr><td class='line-number'><a name='L695' href='#L695'><pre>695</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayVecImpl::as_mut_slice(self)</pre></td></tr><tr><td class='line-number'><a name='L696' href='#L696'><pre>696</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L697' href='#L697'><pre>697</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L698' href='#L698'><pre>698</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return a raw pointer to the vector's buffer.</pre></td></tr><tr><td class='line-number'><a name='L699' href='#L699'><pre>699</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn as_ptr(&self) -> *const T {</pre></td></tr><tr><td class='line-number'><a name='L700' href='#L700'><pre>700</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayVecImpl::as_ptr(self)</pre></td></tr><tr><td class='line-number'><a name='L701' href='#L701'><pre>701</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L702' href='#L702'><pre>702</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L703' href='#L703'><pre>703</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return a raw mutable pointer to the vector's buffer.</pre></td></tr><tr><td class='line-number'><a name='L704' href='#L704'><pre>704</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> pub fn as_mut_ptr(&mut self) -> *mut T {</pre></td></tr><tr><td class='line-number'><a name='L705' href='#L705'><pre>705</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> ArrayVecImpl::as_mut_ptr(self)</pre></td></tr><tr><td class='line-number'><a name='L706' href='#L706'><pre>706</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L707' href='#L707'><pre>707</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L708' href='#L708'><pre>708</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L709' href='#L709'><pre>709</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> ArrayVecImpl for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L710' href='#L710'><pre>710</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = T;</pre></td></tr><tr><td class='line-number'><a name='L711' href='#L711'><pre>711</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const CAPACITY: usize = CAP;</pre></td></tr><tr><td class='line-number'><a name='L712' href='#L712'><pre>712</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L713' href='#L713'><pre>713</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> fn len(&self) -> usize { self.len() }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVecjKj10_ENtNtB7_13arrayvec_impl12ArrayVecImpl3lenCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L713' href='#L713'><pre>713</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn len(&self) -> usize { self.len() }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVechKj1000_ENtNtB7_13arrayvec_impl12ArrayVecImpl3lenCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L713' href='#L713'><pre>713</pre></a></td><td class='covered-line'><pre>12.4k</pre></td><td class='code'><pre> fn len(&self) -> usize { self.len() }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVecjKj80_ENtNtB7_13arrayvec_impl12ArrayVecImpl3lenCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L714' href='#L714'><pre>714</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L715' href='#L715'><pre>715</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> unsafe fn set_len(&mut self, length: usize) {</pre></td></tr><tr><td class='line-number'><a name='L716' href='#L716'><pre>716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> debug_assert!(<span class='red'>length <= CAP</span>);</pre></td></tr><tr><td class='line-number'><a name='L717' href='#L717'><pre>717</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.len = length as LenUint;</pre></td></tr><tr><td class='line-number'><a name='L718' href='#L718'><pre>718</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVechKj1000_ENtNtB7_13arrayvec_impl12ArrayVecImpl7set_lenCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L715' href='#L715'><pre>715</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> unsafe fn set_len(&mut self, length: usize) {</pre></td></tr><tr><td class='line-number'><a name='L716' href='#L716'><pre>716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> debug_assert!(<span class='red'>length <= CAP</span>);</pre></td></tr><tr><td class='line-number'><a name='L717' href='#L717'><pre>717</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.len = length as LenUint;</pre></td></tr><tr><td class='line-number'><a name='L718' href='#L718'><pre>718</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVecjKj10_ENtNtB7_13arrayvec_impl12ArrayVecImpl7set_lenCsgg978DXfVXR_13fuzz_target_1</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVecjKj80_ENtNtB7_13arrayvec_impl12ArrayVecImpl7set_lenCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L719' href='#L719'><pre>719</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L720' href='#L720'><pre>720</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> fn as_ptr(&self) -> *const Self::Item {</pre></td></tr><tr><td class='line-number'><a name='L721' href='#L721'><pre>721</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> self.xs.as_ptr() as _</pre></td></tr><tr><td class='line-number'><a name='L722' href='#L722'><pre>722</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVechKj1000_ENtNtB7_13arrayvec_impl12ArrayVecImpl6as_ptrCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L720' href='#L720'><pre>720</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> fn as_ptr(&self) -> *const Self::Item {</pre></td></tr><tr><td class='line-number'><a name='L721' href='#L721'><pre>721</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> self.xs.as_ptr() as _</pre></td></tr><tr><td class='line-number'><a name='L722' href='#L722'><pre>722</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVecjKj80_ENtNtB7_13arrayvec_impl12ArrayVecImpl6as_ptrCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L723' href='#L723'><pre>723</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L724' href='#L724'><pre>724</pre></a></td><td class='covered-line'><pre>2.29k</pre></td><td class='code'><pre> fn as_mut_ptr(&mut self) -> *mut Self::Item {</pre></td></tr><tr><td class='line-number'><a name='L725' href='#L725'><pre>725</pre></a></td><td class='covered-line'><pre>2.29k</pre></td><td class='code'><pre> self.xs.as_mut_ptr() as _</pre></td></tr><tr><td class='line-number'><a name='L726' href='#L726'><pre>726</pre></a></td><td class='covered-line'><pre>2.29k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVecjKj10_ENtNtB7_13arrayvec_impl12ArrayVecImpl10as_mut_ptrCsgg978DXfVXR_13fuzz_target_1</pre></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVechKj1000_ENtNtB7_13arrayvec_impl12ArrayVecImpl10as_mut_ptrCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L724' href='#L724'><pre>724</pre></a></td><td class='covered-line'><pre>2.29k</pre></td><td class='code'><pre> fn as_mut_ptr(&mut self) -> *mut Self::Item {</pre></td></tr><tr><td class='line-number'><a name='L725' href='#L725'><pre>725</pre></a></td><td class='covered-line'><pre>2.29k</pre></td><td class='code'><pre> self.xs.as_mut_ptr() as _</pre></td></tr><tr><td class='line-number'><a name='L726' href='#L726'><pre>726</pre></a></td><td class='covered-line'><pre>2.29k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs0_NtCskQaAGJdWXwX_8arrayvec8arrayvecINtB5_8ArrayVecjKj80_ENtNtB7_13arrayvec_impl12ArrayVecImpl10as_mut_ptrCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L727' href='#L727'><pre>727</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L728' href='#L728'><pre>728</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L729' href='#L729'><pre>729</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Deref for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L730' href='#L730'><pre>730</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Target = [T];</pre></td></tr><tr><td class='line-number'><a name='L731' href='#L731'><pre>731</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L732' href='#L732'><pre>732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn deref(&self) -> &Self::Target {</span></pre></td></tr><tr><td class='line-number'><a name='L733' href='#L733'><pre>733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.as_slice()</span></pre></td></tr><tr><td class='line-number'><a name='L734' href='#L734'><pre>734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L735' href='#L735'><pre>735</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L736' href='#L736'><pre>736</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L737' href='#L737'><pre>737</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> DerefMut for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L738' href='#L738'><pre>738</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L739' href='#L739'><pre>739</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn deref_mut(&mut self) -> &mut Self::Target {</pre></td></tr><tr><td class='line-number'><a name='L740' href='#L740'><pre>740</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.as_mut_slice()</pre></td></tr><tr><td class='line-number'><a name='L741' href='#L741'><pre>741</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L742' href='#L742'><pre>742</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L743' href='#L743'><pre>743</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L744' href='#L744'><pre>744</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L745' href='#L745'><pre>745</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Create an `ArrayVec` from an array.</pre></td></tr><tr><td class='line-number'><a name='L746' href='#L746'><pre>746</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L747' href='#L747'><pre>747</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L748' href='#L748'><pre>748</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L749' href='#L749'><pre>749</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L750' href='#L750'><pre>750</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L751' href='#L751'><pre>751</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// assert_eq!(array.len(), 3);</pre></td></tr><tr><td class='line-number'><a name='L752' href='#L752'><pre>752</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// assert_eq!(array.capacity(), 3);</pre></td></tr><tr><td class='line-number'><a name='L753' href='#L753'><pre>753</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L754' href='#L754'><pre>754</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> From<[T; CAP]> for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L755' href='#L755'><pre>755</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[track_caller]</pre></td></tr><tr><td class='line-number'><a name='L756' href='#L756'><pre>756</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn from(array: [T; CAP]) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L757' href='#L757'><pre>757</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let array = ManuallyDrop::new(array);</pre></td></tr><tr><td class='line-number'><a name='L758' href='#L758'><pre>758</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut vec = <ArrayVec<T, CAP>>::new();</pre></td></tr><tr><td class='line-number'><a name='L759' href='#L759'><pre>759</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L760' href='#L760'><pre>760</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (&*array as *const [T; CAP] as *const [MaybeUninit<T>; CAP])</pre></td></tr><tr><td class='line-number'><a name='L761' href='#L761'><pre>761</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> .copy_to_nonoverlapping(&mut vec.xs as *mut [MaybeUninit<T>; CAP], 1);</pre></td></tr><tr><td class='line-number'><a name='L762' href='#L762'><pre>762</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> vec.set_len(CAP);</pre></td></tr><tr><td class='line-number'><a name='L763' href='#L763'><pre>763</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L764' href='#L764'><pre>764</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> vec</pre></td></tr><tr><td class='line-number'><a name='L765' href='#L765'><pre>765</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L766' href='#L766'><pre>766</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L767' href='#L767'><pre>767</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L768' href='#L768'><pre>768</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L769' href='#L769'><pre>769</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to create an `ArrayVec` from a slice. This will return an error if the slice was too big to</pre></td></tr><tr><td class='line-number'><a name='L770' href='#L770'><pre>770</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fit.</pre></td></tr><tr><td class='line-number'><a name='L771' href='#L771'><pre>771</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L772' href='#L772'><pre>772</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L773' href='#L773'><pre>773</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L774' href='#L774'><pre>774</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use std::convert::TryInto as _;</pre></td></tr><tr><td class='line-number'><a name='L775' href='#L775'><pre>775</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L776' href='#L776'><pre>776</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let array: ArrayVec<_, 4> = (&[1, 2, 3] as &[_]).try_into().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L777' href='#L777'><pre>777</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// assert_eq!(array.len(), 3);</pre></td></tr><tr><td class='line-number'><a name='L778' href='#L778'><pre>778</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// assert_eq!(array.capacity(), 4);</pre></td></tr><tr><td class='line-number'><a name='L779' href='#L779'><pre>779</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L780' href='#L780'><pre>780</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> std::convert::TryFrom<&[T]> for ArrayVec<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L781' href='#L781'><pre>781</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where T: Clone,</pre></td></tr><tr><td class='line-number'><a name='L782' href='#L782'><pre>782</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L783' href='#L783'><pre>783</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Error = CapacityError;</pre></td></tr><tr><td class='line-number'><a name='L784' href='#L784'><pre>784</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L785' href='#L785'><pre>785</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn try_from(slice: &[T]) -> Result<Self, Self::Error> {</pre></td></tr><tr><td class='line-number'><a name='L786' href='#L786'><pre>786</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if Self::CAPACITY < slice.len() {</pre></td></tr><tr><td class='line-number'><a name='L787' href='#L787'><pre>787</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Err(CapacityError::new(()))</pre></td></tr><tr><td class='line-number'><a name='L788' href='#L788'><pre>788</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L789' href='#L789'><pre>789</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut array = Self::new();</pre></td></tr><tr><td class='line-number'><a name='L790' href='#L790'><pre>790</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> array.extend_from_slice(slice);</pre></td></tr><tr><td class='line-number'><a name='L791' href='#L791'><pre>791</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(array)</pre></td></tr><tr><td class='line-number'><a name='L792' href='#L792'><pre>792</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L793' href='#L793'><pre>793</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L794' href='#L794'><pre>794</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L795' href='#L795'><pre>795</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L796' href='#L796'><pre>796</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L797' href='#L797'><pre>797</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Iterate the `ArrayVec` with references to each element.</pre></td></tr><tr><td class='line-number'><a name='L798' href='#L798'><pre>798</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L799' href='#L799'><pre>799</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L800' href='#L800'><pre>800</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L801' href='#L801'><pre>801</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L802' href='#L802'><pre>802</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L803' href='#L803'><pre>803</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L804' href='#L804'><pre>804</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// for elt in &array {</pre></td></tr><tr><td class='line-number'><a name='L805' href='#L805'><pre>805</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // ...</pre></td></tr><tr><td class='line-number'><a name='L806' href='#L806'><pre>806</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L807' href='#L807'><pre>807</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L808' href='#L808'><pre>808</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T: 'a, const CAP: usize> IntoIterator for &'a ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L809' href='#L809'><pre>809</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = &'a T;</pre></td></tr><tr><td class='line-number'><a name='L810' href='#L810'><pre>810</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type IntoIter = slice::Iter<'a, T>;</pre></td></tr><tr><td class='line-number'><a name='L811' href='#L811'><pre>811</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn into_iter(self) -> Self::IntoIter { self.iter() }</pre></td></tr><tr><td class='line-number'><a name='L812' href='#L812'><pre>812</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L813' href='#L813'><pre>813</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L814' href='#L814'><pre>814</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Iterate the `ArrayVec` with mutable references to each element.</pre></td></tr><tr><td class='line-number'><a name='L815' href='#L815'><pre>815</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L816' href='#L816'><pre>816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L817' href='#L817'><pre>817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L818' href='#L818'><pre>818</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L819' href='#L819'><pre>819</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L820' href='#L820'><pre>820</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L821' href='#L821'><pre>821</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// for elt in &mut array {</pre></td></tr><tr><td class='line-number'><a name='L822' href='#L822'><pre>822</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // ...</pre></td></tr><tr><td class='line-number'><a name='L823' href='#L823'><pre>823</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L824' href='#L824'><pre>824</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L825' href='#L825'><pre>825</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T: 'a, const CAP: usize> IntoIterator for &'a mut ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L826' href='#L826'><pre>826</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = &'a mut T;</pre></td></tr><tr><td class='line-number'><a name='L827' href='#L827'><pre>827</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type IntoIter = slice::IterMut<'a, T>;</pre></td></tr><tr><td class='line-number'><a name='L828' href='#L828'><pre>828</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn into_iter(self) -> Self::IntoIter { self.iter_mut() }</pre></td></tr><tr><td class='line-number'><a name='L829' href='#L829'><pre>829</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L830' href='#L830'><pre>830</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L831' href='#L831'><pre>831</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Iterate the `ArrayVec` with each element by value.</pre></td></tr><tr><td class='line-number'><a name='L832' href='#L832'><pre>832</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L833' href='#L833'><pre>833</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The vector is consumed by this operation.</pre></td></tr><tr><td class='line-number'><a name='L834' href='#L834'><pre>834</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L835' href='#L835'><pre>835</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L836' href='#L836'><pre>836</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L837' href='#L837'><pre>837</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L838' href='#L838'><pre>838</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// for elt in ArrayVec::from([1, 2, 3]) {</pre></td></tr><tr><td class='line-number'><a name='L839' href='#L839'><pre>839</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // ...</pre></td></tr><tr><td class='line-number'><a name='L840' href='#L840'><pre>840</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L841' href='#L841'><pre>841</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L842' href='#L842'><pre>842</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> IntoIterator for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L843' href='#L843'><pre>843</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = T;</pre></td></tr><tr><td class='line-number'><a name='L844' href='#L844'><pre>844</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type IntoIter = IntoIter<T, CAP>;</pre></td></tr><tr><td class='line-number'><a name='L845' href='#L845'><pre>845</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn into_iter(self) -> IntoIter<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L846' href='#L846'><pre>846</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IntoIter { index: 0, v: self, }</pre></td></tr><tr><td class='line-number'><a name='L847' href='#L847'><pre>847</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L848' href='#L848'><pre>848</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L849' href='#L849'><pre>849</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L850' href='#L850'><pre>850</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L851' href='#L851'><pre>851</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature = "zeroize")]</pre></td></tr><tr><td class='line-number'><a name='L852' href='#L852'><pre>852</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// "Best efforts" zeroing of the `ArrayVec`'s buffer when the `zeroize` feature is enabled.</pre></td></tr><tr><td class='line-number'><a name='L853' href='#L853'><pre>853</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L854' href='#L854'><pre>854</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The length is set to 0, and the buffer is dropped and zeroized.</pre></td></tr><tr><td class='line-number'><a name='L855' href='#L855'><pre>855</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Cannot ensure that previous moves of the `ArrayVec` did not leave values on the stack.</pre></td></tr><tr><td class='line-number'><a name='L856' href='#L856'><pre>856</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L857' href='#L857'><pre>857</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L858' href='#L858'><pre>858</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L859' href='#L859'><pre>859</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use zeroize::Zeroize;</pre></td></tr><tr><td class='line-number'><a name='L860' href='#L860'><pre>860</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut array = ArrayVec::from([1, 2, 3]);</pre></td></tr><tr><td class='line-number'><a name='L861' href='#L861'><pre>861</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// array.zeroize();</pre></td></tr><tr><td class='line-number'><a name='L862' href='#L862'><pre>862</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// assert_eq!(array.len(), 0);</pre></td></tr><tr><td class='line-number'><a name='L863' href='#L863'><pre>863</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let data = unsafe { core::slice::from_raw_parts(array.as_ptr(), array.capacity()) };</pre></td></tr><tr><td class='line-number'><a name='L864' href='#L864'><pre>864</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// assert_eq!(data, [0, 0, 0]);</pre></td></tr><tr><td class='line-number'><a name='L865' href='#L865'><pre>865</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L866' href='#L866'><pre>866</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<Z: zeroize::Zeroize, const CAP: usize> zeroize::Zeroize for ArrayVec<Z, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L867' href='#L867'><pre>867</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn zeroize(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L868' href='#L868'><pre>868</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Zeroize all the contained elements.</pre></td></tr><tr><td class='line-number'><a name='L869' href='#L869'><pre>869</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.iter_mut().zeroize();</pre></td></tr><tr><td class='line-number'><a name='L870' href='#L870'><pre>870</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Drop all the elements and set the length to 0.</pre></td></tr><tr><td class='line-number'><a name='L871' href='#L871'><pre>871</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.clear();</pre></td></tr><tr><td class='line-number'><a name='L872' href='#L872'><pre>872</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Zeroize the backing array.</pre></td></tr><tr><td class='line-number'><a name='L873' href='#L873'><pre>873</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.xs.zeroize();</pre></td></tr><tr><td class='line-number'><a name='L874' href='#L874'><pre>874</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L875' href='#L875'><pre>875</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L876' href='#L876'><pre>876</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L877' href='#L877'><pre>877</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// By-value iterator for `ArrayVec`.</pre></td></tr><tr><td class='line-number'><a name='L878' href='#L878'><pre>878</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct IntoIter<T, const CAP: usize> {</pre></td></tr><tr><td class='line-number'><a name='L879' href='#L879'><pre>879</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> index: usize,</pre></td></tr><tr><td class='line-number'><a name='L880' href='#L880'><pre>880</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> v: ArrayVec<T, CAP>,</pre></td></tr><tr><td class='line-number'><a name='L881' href='#L881'><pre>881</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L882' href='#L882'><pre>882</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L883' href='#L883'><pre>883</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Iterator for IntoIter<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L884' href='#L884'><pre>884</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = T;</pre></td></tr><tr><td class='line-number'><a name='L885' href='#L885'><pre>885</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L886' href='#L886'><pre>886</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L887' href='#L887'><pre>887</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if self.index == self.v.len() {</pre></td></tr><tr><td class='line-number'><a name='L888' href='#L888'><pre>888</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> None</pre></td></tr><tr><td class='line-number'><a name='L889' href='#L889'><pre>889</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L890' href='#L890'><pre>890</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L891' href='#L891'><pre>891</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let index = self.index;</pre></td></tr><tr><td class='line-number'><a name='L892' href='#L892'><pre>892</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.index = index + 1;</pre></td></tr><tr><td class='line-number'><a name='L893' href='#L893'><pre>893</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Some(ptr::read(self.v.get_unchecked_ptr(index)))</pre></td></tr><tr><td class='line-number'><a name='L894' href='#L894'><pre>894</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L895' href='#L895'><pre>895</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L896' href='#L896'><pre>896</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L897' href='#L897'><pre>897</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L898' href='#L898'><pre>898</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn size_hint(&self) -> (usize, Option<usize>) {</pre></td></tr><tr><td class='line-number'><a name='L899' href='#L899'><pre>899</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = self.v.len() - self.index;</pre></td></tr><tr><td class='line-number'><a name='L900' href='#L900'><pre>900</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (len, Some(len))</pre></td></tr><tr><td class='line-number'><a name='L901' href='#L901'><pre>901</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L902' href='#L902'><pre>902</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L903' href='#L903'><pre>903</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L904' href='#L904'><pre>904</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> DoubleEndedIterator for IntoIter<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L905' href='#L905'><pre>905</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn next_back(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L906' href='#L906'><pre>906</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if self.index == self.v.len() {</pre></td></tr><tr><td class='line-number'><a name='L907' href='#L907'><pre>907</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> None</pre></td></tr><tr><td class='line-number'><a name='L908' href='#L908'><pre>908</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L909' href='#L909'><pre>909</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L910' href='#L910'><pre>910</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let new_len = self.v.len() - 1;</pre></td></tr><tr><td class='line-number'><a name='L911' href='#L911'><pre>911</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.v.set_len(new_len);</pre></td></tr><tr><td class='line-number'><a name='L912' href='#L912'><pre>912</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Some(ptr::read(self.v.get_unchecked_ptr(new_len)))</pre></td></tr><tr><td class='line-number'><a name='L913' href='#L913'><pre>913</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L914' href='#L914'><pre>914</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L915' href='#L915'><pre>915</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L916' href='#L916'><pre>916</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L917' href='#L917'><pre>917</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L918' href='#L918'><pre>918</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> ExactSizeIterator for IntoIter<T, CAP> { }</pre></td></tr><tr><td class='line-number'><a name='L919' href='#L919'><pre>919</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L920' href='#L920'><pre>920</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Drop for IntoIter<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L921' href='#L921'><pre>921</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn drop(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L922' href='#L922'><pre>922</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // panic safety: Set length to 0 before dropping elements.</pre></td></tr><tr><td class='line-number'><a name='L923' href='#L923'><pre>923</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let index = self.index;</pre></td></tr><tr><td class='line-number'><a name='L924' href='#L924'><pre>924</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = self.v.len();</pre></td></tr><tr><td class='line-number'><a name='L925' href='#L925'><pre>925</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L926' href='#L926'><pre>926</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.v.set_len(0);</pre></td></tr><tr><td class='line-number'><a name='L927' href='#L927'><pre>927</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let elements = slice::from_raw_parts_mut(</pre></td></tr><tr><td class='line-number'><a name='L928' href='#L928'><pre>928</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.v.get_unchecked_ptr(index),</pre></td></tr><tr><td class='line-number'><a name='L929' href='#L929'><pre>929</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> len - index);</pre></td></tr><tr><td class='line-number'><a name='L930' href='#L930'><pre>930</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr::drop_in_place(elements);</pre></td></tr><tr><td class='line-number'><a name='L931' href='#L931'><pre>931</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L932' href='#L932'><pre>932</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L933' href='#L933'><pre>933</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L934' href='#L934'><pre>934</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L935' href='#L935'><pre>935</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Clone for IntoIter<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L936' href='#L936'><pre>936</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>where T: Clone,</pre></td></tr><tr><td class='line-number'><a name='L937' href='#L937'><pre>937</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L938' href='#L938'><pre>938</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn clone(&self) -> IntoIter<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L939' href='#L939'><pre>939</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut v = ArrayVec::new();</pre></td></tr><tr><td class='line-number'><a name='L940' href='#L940'><pre>940</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> v.extend_from_slice(&self.v[self.index..]);</pre></td></tr><tr><td class='line-number'><a name='L941' href='#L941'><pre>941</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> v.into_iter()</pre></td></tr><tr><td class='line-number'><a name='L942' href='#L942'><pre>942</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L943' href='#L943'><pre>943</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L944' href='#L944'><pre>944</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L945' href='#L945'><pre>945</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> fmt::Debug for IntoIter<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L946' href='#L946'><pre>946</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>where</pre></td></tr><tr><td class='line-number'><a name='L947' href='#L947'><pre>947</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> T: fmt::Debug,</pre></td></tr><tr><td class='line-number'><a name='L948' href='#L948'><pre>948</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L949' href='#L949'><pre>949</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {</pre></td></tr><tr><td class='line-number'><a name='L950' href='#L950'><pre>950</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> f.debug_list()</pre></td></tr><tr><td class='line-number'><a name='L951' href='#L951'><pre>951</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> .entries(&self.v[self.index..])</pre></td></tr><tr><td class='line-number'><a name='L952' href='#L952'><pre>952</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> .finish()</pre></td></tr><tr><td class='line-number'><a name='L953' href='#L953'><pre>953</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L954' href='#L954'><pre>954</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L955' href='#L955'><pre>955</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L956' href='#L956'><pre>956</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A draining iterator for `ArrayVec`.</pre></td></tr><tr><td class='line-number'><a name='L957' href='#L957'><pre>957</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Drain<'a, T: 'a, const CAP: usize> {</pre></td></tr><tr><td class='line-number'><a name='L958' href='#L958'><pre>958</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Index of tail to preserve</pre></td></tr><tr><td class='line-number'><a name='L959' href='#L959'><pre>959</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> tail_start: usize,</pre></td></tr><tr><td class='line-number'><a name='L960' href='#L960'><pre>960</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Length of tail</pre></td></tr><tr><td class='line-number'><a name='L961' href='#L961'><pre>961</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> tail_len: usize,</pre></td></tr><tr><td class='line-number'><a name='L962' href='#L962'><pre>962</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Current remaining range to remove</pre></td></tr><tr><td class='line-number'><a name='L963' href='#L963'><pre>963</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> iter: slice::Iter<'a, T>,</pre></td></tr><tr><td class='line-number'><a name='L964' href='#L964'><pre>964</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> vec: *mut ArrayVec<T, CAP>,</pre></td></tr><tr><td class='line-number'><a name='L965' href='#L965'><pre>965</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L966' href='#L966'><pre>966</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L967' href='#L967'><pre>967</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>unsafe impl<'a, T: Sync, const CAP: usize> Sync for Drain<'a, T, CAP> {}</pre></td></tr><tr><td class='line-number'><a name='L968' href='#L968'><pre>968</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>unsafe impl<'a, T: Send, const CAP: usize> Send for Drain<'a, T, CAP> {}</pre></td></tr><tr><td class='line-number'><a name='L969' href='#L969'><pre>969</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L970' href='#L970'><pre>970</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T: 'a, const CAP: usize> Iterator for Drain<'a, T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L971' href='#L971'><pre>971</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = T;</pre></td></tr><tr><td class='line-number'><a name='L972' href='#L972'><pre>972</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L973' href='#L973'><pre>973</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L974' href='#L974'><pre>974</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.iter.next().map(|elt|</pre></td></tr><tr><td class='line-number'><a name='L975' href='#L975'><pre>975</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L976' href='#L976'><pre>976</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr::read(elt as *const _)</pre></td></tr><tr><td class='line-number'><a name='L977' href='#L977'><pre>977</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L978' href='#L978'><pre>978</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> )</pre></td></tr><tr><td class='line-number'><a name='L979' href='#L979'><pre>979</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L980' href='#L980'><pre>980</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L981' href='#L981'><pre>981</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn size_hint(&self) -> (usize, Option<usize>) {</pre></td></tr><tr><td class='line-number'><a name='L982' href='#L982'><pre>982</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.iter.size_hint()</pre></td></tr><tr><td class='line-number'><a name='L983' href='#L983'><pre>983</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L984' href='#L984'><pre>984</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L985' href='#L985'><pre>985</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L986' href='#L986'><pre>986</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T: 'a, const CAP: usize> DoubleEndedIterator for Drain<'a, T, CAP></pre></td></tr><tr><td class='line-number'><a name='L987' href='#L987'><pre>987</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L988' href='#L988'><pre>988</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn next_back(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L989' href='#L989'><pre>989</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.iter.next_back().map(|elt|</pre></td></tr><tr><td class='line-number'><a name='L990' href='#L990'><pre>990</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L991' href='#L991'><pre>991</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr::read(elt as *const _)</pre></td></tr><tr><td class='line-number'><a name='L992' href='#L992'><pre>992</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L993' href='#L993'><pre>993</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> )</pre></td></tr><tr><td class='line-number'><a name='L994' href='#L994'><pre>994</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L995' href='#L995'><pre>995</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L996' href='#L996'><pre>996</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L997' href='#L997'><pre>997</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T: 'a, const CAP: usize> ExactSizeIterator for Drain<'a, T, CAP> {}</pre></td></tr><tr><td class='line-number'><a name='L998' href='#L998'><pre>998</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L999' href='#L999'><pre>999</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T: 'a, const CAP: usize> Drop for Drain<'a, T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1000' href='#L1000'><pre>1000</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn drop(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L1001' href='#L1001'><pre>1001</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // len is currently 0 so panicking while dropping will not cause a double drop.</pre></td></tr><tr><td class='line-number'><a name='L1002' href='#L1002'><pre>1002</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1003' href='#L1003'><pre>1003</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // exhaust self first</pre></td></tr><tr><td class='line-number'><a name='L1004' href='#L1004'><pre>1004</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> while let Some(_) = self.next() { }</pre></td></tr><tr><td class='line-number'><a name='L1005' href='#L1005'><pre>1005</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1006' href='#L1006'><pre>1006</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if self.tail_len > 0 {</pre></td></tr><tr><td class='line-number'><a name='L1007' href='#L1007'><pre>1007</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L1008' href='#L1008'><pre>1008</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let source_vec = &mut *self.vec;</pre></td></tr><tr><td class='line-number'><a name='L1009' href='#L1009'><pre>1009</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // memmove back untouched tail, update to new length</pre></td></tr><tr><td class='line-number'><a name='L1010' href='#L1010'><pre>1010</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let start = source_vec.len();</pre></td></tr><tr><td class='line-number'><a name='L1011' href='#L1011'><pre>1011</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let tail = self.tail_start;</pre></td></tr><tr><td class='line-number'><a name='L1012' href='#L1012'><pre>1012</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let ptr = source_vec.as_mut_ptr();</pre></td></tr><tr><td class='line-number'><a name='L1013' href='#L1013'><pre>1013</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr::copy(ptr.add(tail), ptr.add(start), self.tail_len);</pre></td></tr><tr><td class='line-number'><a name='L1014' href='#L1014'><pre>1014</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> source_vec.set_len(start + self.tail_len);</pre></td></tr><tr><td class='line-number'><a name='L1015' href='#L1015'><pre>1015</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1016' href='#L1016'><pre>1016</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1017' href='#L1017'><pre>1017</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1018' href='#L1018'><pre>1018</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1019' href='#L1019'><pre>1019</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1020' href='#L1020'><pre>1020</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>struct ScopeExitGuard<T, Data, F></pre></td></tr><tr><td class='line-number'><a name='L1021' href='#L1021'><pre>1021</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where F: FnMut(&Data, &mut T)</pre></td></tr><tr><td class='line-number'><a name='L1022' href='#L1022'><pre>1022</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L1023' href='#L1023'><pre>1023</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> value: T,</pre></td></tr><tr><td class='line-number'><a name='L1024' href='#L1024'><pre>1024</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: Data,</pre></td></tr><tr><td class='line-number'><a name='L1025' href='#L1025'><pre>1025</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> f: F,</pre></td></tr><tr><td class='line-number'><a name='L1026' href='#L1026'><pre>1026</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1027' href='#L1027'><pre>1027</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1028' href='#L1028'><pre>1028</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, Data, F> Drop for ScopeExitGuard<T, Data, F></pre></td></tr><tr><td class='line-number'><a name='L1029' href='#L1029'><pre>1029</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where F: FnMut(&Data, &mut T)</pre></td></tr><tr><td class='line-number'><a name='L1030' href='#L1030'><pre>1030</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L1031' href='#L1031'><pre>1031</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn drop(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L1032' href='#L1032'><pre>1032</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (self.f)(&self.data, &mut self.value)</pre></td></tr><tr><td class='line-number'><a name='L1033' href='#L1033'><pre>1033</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1034' href='#L1034'><pre>1034</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1035' href='#L1035'><pre>1035</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1036' href='#L1036'><pre>1036</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1037' href='#L1037'><pre>1037</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1038' href='#L1038'><pre>1038</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Extend the `ArrayVec` with an iterator.</pre></td></tr><tr><td class='line-number'><a name='L1039' href='#L1039'><pre>1039</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// </pre></td></tr><tr><td class='line-number'><a name='L1040' href='#L1040'><pre>1040</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ***Panics*** if extending the vector exceeds its capacity.</pre></td></tr><tr><td class='line-number'><a name='L1041' href='#L1041'><pre>1041</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Extend<T> for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1042' href='#L1042'><pre>1042</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Extend the `ArrayVec` with an iterator.</pre></td></tr><tr><td class='line-number'><a name='L1043' href='#L1043'><pre>1043</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// </pre></td></tr><tr><td class='line-number'><a name='L1044' href='#L1044'><pre>1044</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ***Panics*** if extending the vector exceeds its capacity.</pre></td></tr><tr><td class='line-number'><a name='L1045' href='#L1045'><pre>1045</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[track_caller]</pre></td></tr><tr><td class='line-number'><a name='L1046' href='#L1046'><pre>1046</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn extend<I: IntoIterator<Item=T>>(&mut self, iter: I) {</pre></td></tr><tr><td class='line-number'><a name='L1047' href='#L1047'><pre>1047</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L1048' href='#L1048'><pre>1048</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.extend_from_iter::<_, true>(iter)</pre></td></tr><tr><td class='line-number'><a name='L1049' href='#L1049'><pre>1049</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1050' href='#L1050'><pre>1050</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1051' href='#L1051'><pre>1051</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1052' href='#L1052'><pre>1052</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1053' href='#L1053'><pre>1053</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[inline(never)]</pre></td></tr><tr><td class='line-number'><a name='L1054' href='#L1054'><pre>1054</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cold]</pre></td></tr><tr><td class='line-number'><a name='L1055' href='#L1055'><pre>1055</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[track_caller]</pre></td></tr><tr><td class='line-number'><a name='L1056' href='#L1056'><pre>1056</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>fn extend_panic() {</pre></td></tr><tr><td class='line-number'><a name='L1057' href='#L1057'><pre>1057</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> panic!("ArrayVec: capacity exceeded in extend/from_iter");</pre></td></tr><tr><td class='line-number'><a name='L1058' href='#L1058'><pre>1058</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1059' href='#L1059'><pre>1059</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1060' href='#L1060'><pre>1060</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1061' href='#L1061'><pre>1061</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Extend the arrayvec from the iterable.</pre></td></tr><tr><td class='line-number'><a name='L1062' href='#L1062'><pre>1062</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1063' href='#L1063'><pre>1063</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ## Safety</pre></td></tr><tr><td class='line-number'><a name='L1064' href='#L1064'><pre>1064</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1065' href='#L1065'><pre>1065</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Unsafe because if CHECK is false, the length of the input is not checked.</pre></td></tr><tr><td class='line-number'><a name='L1066' href='#L1066'><pre>1066</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The caller must ensure the length of the input fits in the capacity.</pre></td></tr><tr><td class='line-number'><a name='L1067' href='#L1067'><pre>1067</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[track_caller]</pre></td></tr><tr><td class='line-number'><a name='L1068' href='#L1068'><pre>1068</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) unsafe fn extend_from_iter<I, const CHECK: bool>(&mut self, iterable: I)</pre></td></tr><tr><td class='line-number'><a name='L1069' href='#L1069'><pre>1069</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where I: IntoIterator<Item = T></pre></td></tr><tr><td class='line-number'><a name='L1070' href='#L1070'><pre>1070</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L1071' href='#L1071'><pre>1071</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let take = self.capacity() - self.len();</pre></td></tr><tr><td class='line-number'><a name='L1072' href='#L1072'><pre>1072</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L1073' href='#L1073'><pre>1073</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut ptr = raw_ptr_add(self.as_mut_ptr(), len);</pre></td></tr><tr><td class='line-number'><a name='L1074' href='#L1074'><pre>1074</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let end_ptr = raw_ptr_add(ptr, take);</pre></td></tr><tr><td class='line-number'><a name='L1075' href='#L1075'><pre>1075</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Keep the length in a separate variable, write it back on scope</pre></td></tr><tr><td class='line-number'><a name='L1076' href='#L1076'><pre>1076</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // exit. To help the compiler with alias analysis and stuff.</pre></td></tr><tr><td class='line-number'><a name='L1077' href='#L1077'><pre>1077</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // We update the length to handle panic in the iteration of the</pre></td></tr><tr><td class='line-number'><a name='L1078' href='#L1078'><pre>1078</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // user's iterator, without dropping any elements on the floor.</pre></td></tr><tr><td class='line-number'><a name='L1079' href='#L1079'><pre>1079</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut guard = ScopeExitGuard {</pre></td></tr><tr><td class='line-number'><a name='L1080' href='#L1080'><pre>1080</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> value: &mut self.len,</pre></td></tr><tr><td class='line-number'><a name='L1081' href='#L1081'><pre>1081</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: len,</pre></td></tr><tr><td class='line-number'><a name='L1082' href='#L1082'><pre>1082</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> f: move |&len, self_len| {</pre></td></tr><tr><td class='line-number'><a name='L1083' href='#L1083'><pre>1083</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> **self_len = len as LenUint;</pre></td></tr><tr><td class='line-number'><a name='L1084' href='#L1084'><pre>1084</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1085' href='#L1085'><pre>1085</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L1086' href='#L1086'><pre>1086</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut iter = iterable.into_iter();</pre></td></tr><tr><td class='line-number'><a name='L1087' href='#L1087'><pre>1087</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> loop {</pre></td></tr><tr><td class='line-number'><a name='L1088' href='#L1088'><pre>1088</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if let Some(elt) = iter.next() {</pre></td></tr><tr><td class='line-number'><a name='L1089' href='#L1089'><pre>1089</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if ptr == end_ptr && CHECK { extend_panic(); }</pre></td></tr><tr><td class='line-number'><a name='L1090' href='#L1090'><pre>1090</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> debug_assert_ne!(ptr, end_ptr);</pre></td></tr><tr><td class='line-number'><a name='L1091' href='#L1091'><pre>1091</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr.write(elt);</pre></td></tr><tr><td class='line-number'><a name='L1092' href='#L1092'><pre>1092</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr = raw_ptr_add(ptr, 1);</pre></td></tr><tr><td class='line-number'><a name='L1093' href='#L1093'><pre>1093</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> guard.data += 1;</pre></td></tr><tr><td class='line-number'><a name='L1094' href='#L1094'><pre>1094</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L1095' href='#L1095'><pre>1095</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return; // success</pre></td></tr><tr><td class='line-number'><a name='L1096' href='#L1096'><pre>1096</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1097' href='#L1097'><pre>1097</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1098' href='#L1098'><pre>1098</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1099' href='#L1099'><pre>1099</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1100' href='#L1100'><pre>1100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Extend the ArrayVec with clones of elements from the slice;</pre></td></tr><tr><td class='line-number'><a name='L1101' href='#L1101'><pre>1101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the length of the slice must be <= the remaining capacity in the arrayvec.</pre></td></tr><tr><td class='line-number'><a name='L1102' href='#L1102'><pre>1102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn extend_from_slice(&mut self, slice: &[T])</pre></td></tr><tr><td class='line-number'><a name='L1103' href='#L1103'><pre>1103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where T: Clone</pre></td></tr><tr><td class='line-number'><a name='L1104' href='#L1104'><pre>1104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L1105' href='#L1105'><pre>1105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let take = self.capacity() - self.len();</pre></td></tr><tr><td class='line-number'><a name='L1106' href='#L1106'><pre>1106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> debug_assert!(slice.len() <= take);</pre></td></tr><tr><td class='line-number'><a name='L1107' href='#L1107'><pre>1107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L1108' href='#L1108'><pre>1108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let slice = if take < slice.len() { &slice[..take] } else { slice };</pre></td></tr><tr><td class='line-number'><a name='L1109' href='#L1109'><pre>1109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.extend_from_iter::<_, false>(slice.iter().cloned());</pre></td></tr><tr><td class='line-number'><a name='L1110' href='#L1110'><pre>1110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1111' href='#L1111'><pre>1111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1112' href='#L1112'><pre>1112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1113' href='#L1113'><pre>1113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1114' href='#L1114'><pre>1114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Rawptr add but uses arithmetic distance for ZST</pre></td></tr><tr><td class='line-number'><a name='L1115' href='#L1115'><pre>1115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>unsafe fn raw_ptr_add<T>(ptr: *mut T, offset: usize) -> *mut T {</pre></td></tr><tr><td class='line-number'><a name='L1116' href='#L1116'><pre>1116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if mem::size_of::<T>() == 0 {</pre></td></tr><tr><td class='line-number'><a name='L1117' href='#L1117'><pre>1117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Special case for ZST</pre></td></tr><tr><td class='line-number'><a name='L1118' href='#L1118'><pre>1118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr.cast::<u8>().wrapping_add(offset).cast()</pre></td></tr><tr><td class='line-number'><a name='L1119' href='#L1119'><pre>1119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L1120' href='#L1120'><pre>1120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr.add(offset)</pre></td></tr><tr><td class='line-number'><a name='L1121' href='#L1121'><pre>1121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1122' href='#L1122'><pre>1122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1123' href='#L1123'><pre>1123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1124' href='#L1124'><pre>1124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Create an `ArrayVec` from an iterator.</pre></td></tr><tr><td class='line-number'><a name='L1125' href='#L1125'><pre>1125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// </pre></td></tr><tr><td class='line-number'><a name='L1126' href='#L1126'><pre>1126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ***Panics*** if the number of elements in the iterator exceeds the arrayvec's capacity.</pre></td></tr><tr><td class='line-number'><a name='L1127' href='#L1127'><pre>1127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> iter::FromIterator<T> for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1128' href='#L1128'><pre>1128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Create an `ArrayVec` from an iterator.</pre></td></tr><tr><td class='line-number'><a name='L1129' href='#L1129'><pre>1129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// </pre></td></tr><tr><td class='line-number'><a name='L1130' href='#L1130'><pre>1130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ***Panics*** if the number of elements in the iterator exceeds the arrayvec's capacity.</pre></td></tr><tr><td class='line-number'><a name='L1131' href='#L1131'><pre>1131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L1132' href='#L1132'><pre>1132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut array = ArrayVec::new();</pre></td></tr><tr><td class='line-number'><a name='L1133' href='#L1133'><pre>1133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> array.extend(iter);</pre></td></tr><tr><td class='line-number'><a name='L1134' href='#L1134'><pre>1134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> array</pre></td></tr><tr><td class='line-number'><a name='L1135' href='#L1135'><pre>1135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1136' href='#L1136'><pre>1136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1137' href='#L1137'><pre>1137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1138' href='#L1138'><pre>1138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Clone for ArrayVec<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L1139' href='#L1139'><pre>1139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where T: Clone</pre></td></tr><tr><td class='line-number'><a name='L1140' href='#L1140'><pre>1140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L1141' href='#L1141'><pre>1141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn clone(&self) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L1142' href='#L1142'><pre>1142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.iter().cloned().collect()</pre></td></tr><tr><td class='line-number'><a name='L1143' href='#L1143'><pre>1143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1144' href='#L1144'><pre>1144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1145' href='#L1145'><pre>1145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn clone_from(&mut self, rhs: &Self) {</pre></td></tr><tr><td class='line-number'><a name='L1146' href='#L1146'><pre>1146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // recursive case for the common prefix</pre></td></tr><tr><td class='line-number'><a name='L1147' href='#L1147'><pre>1147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let prefix = cmp::min(self.len(), rhs.len());</pre></td></tr><tr><td class='line-number'><a name='L1148' href='#L1148'><pre>1148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self[..prefix].clone_from_slice(&rhs[..prefix]);</pre></td></tr><tr><td class='line-number'><a name='L1149' href='#L1149'><pre>1149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1150' href='#L1150'><pre>1150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if prefix < self.len() {</pre></td></tr><tr><td class='line-number'><a name='L1151' href='#L1151'><pre>1151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // rhs was shorter</pre></td></tr><tr><td class='line-number'><a name='L1152' href='#L1152'><pre>1152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.truncate(prefix);</pre></td></tr><tr><td class='line-number'><a name='L1153' href='#L1153'><pre>1153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L1154' href='#L1154'><pre>1154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let rhs_elems = &rhs[self.len()..];</pre></td></tr><tr><td class='line-number'><a name='L1155' href='#L1155'><pre>1155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.extend_from_slice(rhs_elems);</pre></td></tr><tr><td class='line-number'><a name='L1156' href='#L1156'><pre>1156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1157' href='#L1157'><pre>1157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1158' href='#L1158'><pre>1158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1159' href='#L1159'><pre>1159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1160' href='#L1160'><pre>1160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Hash for ArrayVec<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L1161' href='#L1161'><pre>1161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where T: Hash</pre></td></tr><tr><td class='line-number'><a name='L1162' href='#L1162'><pre>1162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L1163' href='#L1163'><pre>1163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn hash<H: Hasher>(&self, state: &mut H) {</pre></td></tr><tr><td class='line-number'><a name='L1164' href='#L1164'><pre>1164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Hash::hash(&**self, state)</pre></td></tr><tr><td class='line-number'><a name='L1165' href='#L1165'><pre>1165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1166' href='#L1166'><pre>1166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1167' href='#L1167'><pre>1167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1168' href='#L1168'><pre>1168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> PartialEq for ArrayVec<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L1169' href='#L1169'><pre>1169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where T: PartialEq</pre></td></tr><tr><td class='line-number'><a name='L1170' href='#L1170'><pre>1170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L1171' href='#L1171'><pre>1171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn eq(&self, other: &Self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L1172' href='#L1172'><pre>1172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> **self == **other</pre></td></tr><tr><td class='line-number'><a name='L1173' href='#L1173'><pre>1173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1174' href='#L1174'><pre>1174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1175' href='#L1175'><pre>1175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1176' href='#L1176'><pre>1176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> PartialEq<[T]> for ArrayVec<T, CAP></pre></td></tr><tr><td class='line-number'><a name='L1177' href='#L1177'><pre>1177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where T: PartialEq</pre></td></tr><tr><td class='line-number'><a name='L1178' href='#L1178'><pre>1178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L1179' href='#L1179'><pre>1179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn eq(&self, other: &[T]) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L1180' href='#L1180'><pre>1180</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> **self == *other</pre></td></tr><tr><td class='line-number'><a name='L1181' href='#L1181'><pre>1181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1182' href='#L1182'><pre>1182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1183' href='#L1183'><pre>1183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1184' href='#L1184'><pre>1184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Eq for ArrayVec<T, CAP> where T: Eq { }</pre></td></tr><tr><td class='line-number'><a name='L1185' href='#L1185'><pre>1185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1186' href='#L1186'><pre>1186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Borrow<[T]> for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1187' href='#L1187'><pre>1187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn borrow(&self) -> &[T] { self }</pre></td></tr><tr><td class='line-number'><a name='L1188' href='#L1188'><pre>1188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1189' href='#L1189'><pre>1189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1190' href='#L1190'><pre>1190</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> BorrowMut<[T]> for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1191' href='#L1191'><pre>1191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn borrow_mut(&mut self) -> &mut [T] { self }</pre></td></tr><tr><td class='line-number'><a name='L1192' href='#L1192'><pre>1192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1193' href='#L1193'><pre>1193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1194' href='#L1194'><pre>1194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> AsRef<[T]> for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1195' href='#L1195'><pre>1195</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn as_ref(&self) -> &[T] { self }</pre></td></tr><tr><td class='line-number'><a name='L1196' href='#L1196'><pre>1196</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1197' href='#L1197'><pre>1197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1198' href='#L1198'><pre>1198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> AsMut<[T]> for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1199' href='#L1199'><pre>1199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn as_mut(&mut self) -> &mut [T] { self }</pre></td></tr><tr><td class='line-number'><a name='L1200' href='#L1200'><pre>1200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1201' href='#L1201'><pre>1201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1202' href='#L1202'><pre>1202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> fmt::Debug for ArrayVec<T, CAP> where T: fmt::Debug {</pre></td></tr><tr><td class='line-number'><a name='L1203' href='#L1203'><pre>1203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) }</pre></td></tr><tr><td class='line-number'><a name='L1204' href='#L1204'><pre>1204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1205' href='#L1205'><pre>1205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1206' href='#L1206'><pre>1206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Default for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1207' href='#L1207'><pre>1207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return an empty array</pre></td></tr><tr><td class='line-number'><a name='L1208' href='#L1208'><pre>1208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn default() -> ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1209' href='#L1209'><pre>1209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayVec::new()</pre></td></tr><tr><td class='line-number'><a name='L1210' href='#L1210'><pre>1210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1211' href='#L1211'><pre>1211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1212' href='#L1212'><pre>1212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1213' href='#L1213'><pre>1213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> PartialOrd for ArrayVec<T, CAP> where T: PartialOrd {</pre></td></tr><tr><td class='line-number'><a name='L1214' href='#L1214'><pre>1214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {</pre></td></tr><tr><td class='line-number'><a name='L1215' href='#L1215'><pre>1215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (**self).partial_cmp(other)</pre></td></tr><tr><td class='line-number'><a name='L1216' href='#L1216'><pre>1216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1217' href='#L1217'><pre>1217</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1218' href='#L1218'><pre>1218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn lt(&self, other: &Self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L1219' href='#L1219'><pre>1219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (**self).lt(other)</pre></td></tr><tr><td class='line-number'><a name='L1220' href='#L1220'><pre>1220</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1221' href='#L1221'><pre>1221</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1222' href='#L1222'><pre>1222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn le(&self, other: &Self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L1223' href='#L1223'><pre>1223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (**self).le(other)</pre></td></tr><tr><td class='line-number'><a name='L1224' href='#L1224'><pre>1224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1225' href='#L1225'><pre>1225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1226' href='#L1226'><pre>1226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn ge(&self, other: &Self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L1227' href='#L1227'><pre>1227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (**self).ge(other)</pre></td></tr><tr><td class='line-number'><a name='L1228' href='#L1228'><pre>1228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1229' href='#L1229'><pre>1229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1230' href='#L1230'><pre>1230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn gt(&self, other: &Self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L1231' href='#L1231'><pre>1231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (**self).gt(other)</pre></td></tr><tr><td class='line-number'><a name='L1232' href='#L1232'><pre>1232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1233' href='#L1233'><pre>1233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1234' href='#L1234'><pre>1234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1235' href='#L1235'><pre>1235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T, const CAP: usize> Ord for ArrayVec<T, CAP> where T: Ord {</pre></td></tr><tr><td class='line-number'><a name='L1236' href='#L1236'><pre>1236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn cmp(&self, other: &Self) -> cmp::Ordering {</pre></td></tr><tr><td class='line-number'><a name='L1237' href='#L1237'><pre>1237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (**self).cmp(other)</pre></td></tr><tr><td class='line-number'><a name='L1238' href='#L1238'><pre>1238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1239' href='#L1239'><pre>1239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1240' href='#L1240'><pre>1240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1241' href='#L1241'><pre>1241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature="std")]</pre></td></tr><tr><td class='line-number'><a name='L1242' href='#L1242'><pre>1242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// `Write` appends written data to the end of the vector.</pre></td></tr><tr><td class='line-number'><a name='L1243' href='#L1243'><pre>1243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L1244' href='#L1244'><pre>1244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Requires `features="std"`.</pre></td></tr><tr><td class='line-number'><a name='L1245' href='#L1245'><pre>1245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<const CAP: usize> io::Write for ArrayVec<u8, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1246' href='#L1246'><pre>1246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write(&mut self, data: &[u8]) -> io::Result<usize> {</pre></td></tr><tr><td class='line-number'><a name='L1247' href='#L1247'><pre>1247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = cmp::min(self.remaining_capacity(), data.len());</pre></td></tr><tr><td class='line-number'><a name='L1248' href='#L1248'><pre>1248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let _result = self.try_extend_from_slice(&data[..len]);</pre></td></tr><tr><td class='line-number'><a name='L1249' href='#L1249'><pre>1249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> debug_assert!(_result.is_ok());</pre></td></tr><tr><td class='line-number'><a name='L1250' href='#L1250'><pre>1250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(len)</pre></td></tr><tr><td class='line-number'><a name='L1251' href='#L1251'><pre>1251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1252' href='#L1252'><pre>1252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn flush(&mut self) -> io::Result<()> { Ok(()) }</pre></td></tr><tr><td class='line-number'><a name='L1253' href='#L1253'><pre>1253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1254' href='#L1254'><pre>1254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1255' href='#L1255'><pre>1255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature="serde")]</pre></td></tr><tr><td class='line-number'><a name='L1256' href='#L1256'><pre>1256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Requires crate feature `"serde"`</pre></td></tr><tr><td class='line-number'><a name='L1257' href='#L1257'><pre>1257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T: Serialize, const CAP: usize> Serialize for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1258' href='#L1258'><pre>1258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error></pre></td></tr><tr><td class='line-number'><a name='L1259' href='#L1259'><pre>1259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where S: Serializer</pre></td></tr><tr><td class='line-number'><a name='L1260' href='#L1260'><pre>1260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L1261' href='#L1261'><pre>1261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> serializer.collect_seq(self)</pre></td></tr><tr><td class='line-number'><a name='L1262' href='#L1262'><pre>1262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1263' href='#L1263'><pre>1263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1264' href='#L1264'><pre>1264</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1265' href='#L1265'><pre>1265</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature="serde")]</pre></td></tr><tr><td class='line-number'><a name='L1266' href='#L1266'><pre>1266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Requires crate feature `"serde"`</pre></td></tr><tr><td class='line-number'><a name='L1267' href='#L1267'><pre>1267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'de, T: Deserialize<'de>, const CAP: usize> Deserialize<'de> for ArrayVec<T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1268' href='#L1268'><pre>1268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error></pre></td></tr><tr><td class='line-number'><a name='L1269' href='#L1269'><pre>1269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where D: Deserializer<'de></pre></td></tr><tr><td class='line-number'><a name='L1270' href='#L1270'><pre>1270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L1271' href='#L1271'><pre>1271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use serde::de::{Visitor, SeqAccess, Error};</pre></td></tr><tr><td class='line-number'><a name='L1272' href='#L1272'><pre>1272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use std::marker::PhantomData;</pre></td></tr><tr><td class='line-number'><a name='L1273' href='#L1273'><pre>1273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1274' href='#L1274'><pre>1274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> struct ArrayVecVisitor<'de, T: Deserialize<'de>, const CAP: usize>(PhantomData<(&'de (), [T; CAP])>);</pre></td></tr><tr><td class='line-number'><a name='L1275' href='#L1275'><pre>1275</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1276' href='#L1276'><pre>1276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<'de, T: Deserialize<'de>, const CAP: usize> Visitor<'de> for ArrayVecVisitor<'de, T, CAP> {</pre></td></tr><tr><td class='line-number'><a name='L1277' href='#L1277'><pre>1277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Value = ArrayVec<T, CAP>;</pre></td></tr><tr><td class='line-number'><a name='L1278' href='#L1278'><pre>1278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1279' href='#L1279'><pre>1279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {</pre></td></tr><tr><td class='line-number'><a name='L1280' href='#L1280'><pre>1280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> write!(formatter, "an array with no more than {} items", CAP)</pre></td></tr><tr><td class='line-number'><a name='L1281' href='#L1281'><pre>1281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1282' href='#L1282'><pre>1282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1283' href='#L1283'><pre>1283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn visit_seq<SA>(self, mut seq: SA) -> Result<Self::Value, SA::Error></pre></td></tr><tr><td class='line-number'><a name='L1284' href='#L1284'><pre>1284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where SA: SeqAccess<'de>,</pre></td></tr><tr><td class='line-number'><a name='L1285' href='#L1285'><pre>1285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L1286' href='#L1286'><pre>1286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut values = ArrayVec::<T, CAP>::new();</pre></td></tr><tr><td class='line-number'><a name='L1287' href='#L1287'><pre>1287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1288' href='#L1288'><pre>1288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> while let Some(value) = seq.next_element()? {</pre></td></tr><tr><td class='line-number'><a name='L1289' href='#L1289'><pre>1289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if let Err(_) = values.try_push(value) {</pre></td></tr><tr><td class='line-number'><a name='L1290' href='#L1290'><pre>1290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(SA::Error::invalid_length(CAP + 1, &self));</pre></td></tr><tr><td class='line-number'><a name='L1291' href='#L1291'><pre>1291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1292' href='#L1292'><pre>1292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1293' href='#L1293'><pre>1293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1294' href='#L1294'><pre>1294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(values)</pre></td></tr><tr><td class='line-number'><a name='L1295' href='#L1295'><pre>1295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1296' href='#L1296'><pre>1296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1297' href='#L1297'><pre>1297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1298' href='#L1298'><pre>1298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> deserializer.deserialize_seq(ArrayVecVisitor::<T, CAP>(PhantomData))</pre></td></tr><tr><td class='line-number'><a name='L1299' href='#L1299'><pre>1299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1300' href='#L1300'><pre>1300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayvec-0.7.4/src/arrayvec_impl.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L39'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::ptr;</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::slice;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::CapacityError;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Implements basic arrayvec methods - based on a few required methods</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// for length and element access.</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub(crate) trait ArrayVecImpl {</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item;</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const CAPACITY: usize;</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn len(&self) -> usize;</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe fn set_len(&mut self, new_len: usize);</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return a slice containing all elements of the vector.</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> fn as_slice(&self) -> &[Self::Item] {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> slice::from_raw_parts(self.as_ptr(), len)</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvYINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_ENtNtB7_13arrayvec_impl12ArrayVecImpl8as_sliceCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> fn as_slice(&self) -> &[Self::Item] {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> slice::from_raw_parts(self.as_ptr(), len)</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvYINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVecjKj80_ENtNtB7_13arrayvec_impl12ArrayVecImpl8as_sliceCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return a mutable slice containing all elements of the vector.</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn as_mut_slice(&mut self) -> &mut [Self::Item] {</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return a raw pointer to the vector's buffer.</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn as_ptr(&self) -> *const Self::Item;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return a raw mutable pointer to the vector's buffer.</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn as_mut_ptr(&mut self) -> *mut Self::Item;</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[track_caller]</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn push(&mut self, element: Self::Item) {</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.try_push(element).unwrap()</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn try_push(&mut self, element: Self::Item) -> Result<(), CapacityError<Self::Item>> {</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.len() < Self::CAPACITY</span> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>unsafe {</span></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.push_unchecked(element);</span></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Err(CapacityError::new(element))</span></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>unsafe fn push_unchecked(&mut self, element: Self::Item) {</span></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let len = self.len()</span>;</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> debug_assert!(<span class='red'>len < Self::CAPACITY</span>);</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>ptr::write(self.as_mut_ptr().add(len), element);</span></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.set_len(len + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn pop(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if self.len() == 0 {</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let new_len = self.len() - 1;</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.set_len(new_len);</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Some(ptr::read(self.as_ptr().add(new_len)))</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> fn clear(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> self.truncate(0)</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvYINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_ENtNtB7_13arrayvec_impl12ArrayVecImpl5clearCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn clear(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.truncate(0)</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvYINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVecjKj10_ENtNtB7_13arrayvec_impl12ArrayVecImpl5clearCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn clear(&mut self) {</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.truncate(0)</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvYINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVecjKj80_ENtNtB7_13arrayvec_impl12ArrayVecImpl5clearCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> fn truncate(&mut self, new_len: usize) {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> if new_len < len {</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.set_len(new_len);</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let tail = slice::from_raw_parts_mut(self.as_mut_ptr().add(new_len), len - new_len);</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr::drop_in_place(tail);</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvYINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_ENtNtB7_13arrayvec_impl12ArrayVecImpl8truncateCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn truncate(&mut self, new_len: usize) {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if new_len < len {</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.set_len(new_len);</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let tail = slice::from_raw_parts_mut(self.as_mut_ptr().add(new_len), len - new_len);</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr::drop_in_place(tail);</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvYINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVecjKj10_ENtNtB7_13arrayvec_impl12ArrayVecImpl8truncateCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn truncate(&mut self, new_len: usize) {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let len = self.len();</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if new_len < len <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.set_len(new_len);</span></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let tail = slice::from_raw_parts_mut(self.as_mut_ptr().add(new_len), len - new_len);</span></pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr::drop_in_place(tail);</span></pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvYINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVecjKj80_ENtNtB7_13arrayvec_impl12ArrayVecImpl8truncateCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayvec-0.7.4/src/errors.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L15'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::fmt;</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature="std")]</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::any::Any;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature="std")]</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::error::Error;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Error value indicating insufficient capacity</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct CapacityError<T = ()> {</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> element: T,</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T> CapacityError<T> {</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Create a new `CapacityError` from `element`.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new(element: T) -> CapacityError<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CapacityError {</span></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> element: element,</span></pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCskQaAGJdWXwX_8arrayvec6errorsNtB2_13CapacityError3newCsgg978DXfVXR_13fuzz_target_1</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCskQaAGJdWXwX_8arrayvec6errorsINtB2_13CapacityErrorjE3newCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Extract the overflowing element</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn element(self) -> T {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.element</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Convert into a `CapacityError` that does not carry an element.</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn simplify(self) -> CapacityError {</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CapacityError { element: () }</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const CAPERROR: &'static str = "insufficient capacity";</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature="std")]</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Requires `features="std"`.</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T: Any> Error for CapacityError<T> {}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T> fmt::Display for CapacityError<T> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> write!(f, "{}", CAPERROR)</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T> fmt::Debug for CapacityError<T> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> write!(f, "{}: {}", "CapacityError", CAPERROR)</span></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs1_NtCskQaAGJdWXwX_8arrayvec6errorsNtB5_13CapacityErrorNtNtCs6xNykbTfrCs_4core3fmt5Debug3fmtCsgg978DXfVXR_13fuzz_target_1</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs1_NtCskQaAGJdWXwX_8arrayvec6errorsINtB5_13CapacityErrorjENtNtCs6xNykbTfrCs_4core3fmt5Debug3fmtCslLTLXfmDngu_8flex_dns</pre></div></div></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libfuzzer-sys-0.4.7/src/lib.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L20'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Bindings to [libFuzzer](http://llvm.org/docs/LibFuzzer.html): a runtime for</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! coverage-guided fuzzing.</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! See [the `cargo-fuzz`</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! guide](https://rust-fuzz.github.io/book/cargo-fuzz.html) for a usage</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! tutorial.</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! The main export of this crate is [the `fuzz_target!`</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! macro](./macro.fuzz_target.html), which allows you to define targets for</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! libFuzzer to exercise.</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#![deny(missing_docs, missing_debug_implementations)]</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use arbitrary;</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Indicates whether the input should be kept in the corpus or rejected. This</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// should be returned by your fuzz target. If your fuzz target does not return</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// a value (i.e., returns `()`), then the input will be kept in the corpus.</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>D</span>ebu<span class='red'>g</span>)]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum Corpus {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Keep the input in the corpus.</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Keep,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Reject the input and do not keep it in the corpus.</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Reject,</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<()> for Corpus {</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(_: ()) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Self::Keep</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl Corpus {</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[doc(hidden)]</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Convert this Corpus result into the [integer codes used by</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// `libFuzzer`](https://llvm.org/docs/LibFuzzer.html#rejecting-unwanted-inputs).</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This is -1 for reject, 0 for keep.</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn to_libfuzzer_code(self) -> i32 {</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self</span> {</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Corpus::Keep => <span class='red'>0</span>,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Corpus::Reject => <span class='red'>-1</span>,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>extern "C" {</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // We do not actually cross the FFI bound here.</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[allow(improper_ctypes)]</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn rust_fuzzer_test_input(input: &[u8]) -> i32;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn LLVMFuzzerMutate(data: *mut u8, size: usize, max_size: usize) -> usize;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[doc(hidden)]</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[export_name = "LLVMFuzzerTestOneInput"]</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre>pub fn test_input_wrap(data: *const u8, size: usize) -> i32 {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let test_input = ::std::panic::catch_unwind(|| unsafe {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let data_slice = ::std::slice::from_raw_parts(data, size);</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> rust_fuzzer_test_input(data_slice)</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> match test_input {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(i) => i,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Err(_) => {</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // hopefully the custom panic hook will be called before and abort the</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // process before the stack frames are unwinded.</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>::std::process::abort()</span>;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[doc(hidden)]</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub static RUST_LIBFUZZER_DEBUG_PATH: OnceCell<String> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[doc(hidden)]</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[export_name = "LLVMFuzzerInitialize"]</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre>pub fn initialize(_argc: *const isize, _argv: *const *const *const u8) -> isize {</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // Registers a panic hook that aborts the process before unwinding.</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // It is useful to abort before unwinding so that the fuzzer will then be</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // able to analyse the process stack frames to tell different bugs appart.</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // HACK / FIXME: it would be better to use `-C panic=abort` but it's currently</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // impossible to build code using compiler plugins with this flag.</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // We will be able to remove this code when</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // https://github.com/rust-lang/cargo/issues/5423 is fixed.</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let default_hook = ::std::panic::take_hook();</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ::std::panic::set_hook(Box::new(move |panic_info| <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> default_hook(panic_info);</span></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ::std::process::abort()</span>;</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }));</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Initialize the `RUST_LIBFUZZER_DEBUG_PATH` cell with the path so it can be</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // reused with little overhead.</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if let Ok(<span class='red'>path</span>) = std::env::var("RUST_LIBFUZZER_DEBUG_PATH") <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RUST_LIBFUZZER_DEBUG_PATH</span></pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .set(path)</span></pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .expect("Since this is initialize it is only called once so can never fail");</span></pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> 0</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Define a fuzz target.</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ## Example</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This example takes a `&[u8]` slice and attempts to parse it. The parsing</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// might fail and return an `Err`, but it shouldn't ever panic or segfault.</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```no_run</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// #![no_main]</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use libfuzzer_sys::fuzz_target;</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Note: `|input|` is short for `|input: &[u8]|`.</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fuzz_target!(|input| {</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let _result: Result<_, _> = my_crate::parse(input);</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// });</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # mod my_crate { pub fn parse(_: &[u8]) -> Result<(), ()> { unimplemented!() } }</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ## Rejecting Inputs</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// It may be desirable to reject some inputs, i.e. to not add them to the</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// corpus.</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// For example, when fuzzing an API consisting of parsing and other logic,</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// one may want to allow only those inputs into the corpus that parse</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// successfully. To indicate whether an input should be kept in or rejected</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// from the corpus, return either [Corpus::Keep] or [Corpus::Reject] from your</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fuzz target. The default behavior (e.g. if `()` is returned) is to keep the</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// input in the corpus.</pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// For example:</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```no_run</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// #![no_main]</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use libfuzzer_sys::{Corpus, fuzz_target};</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fuzz_target!(|input: String| -> Corpus {</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let parts: Vec<&str> = input.splitn(2, '=').collect();</pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if parts.len() != 2 {</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// return Corpus::Reject;</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let key = parts[0];</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let value = parts[1];</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let _result: Result<_, _> = my_crate::parse(key, value);</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Corpus::Keep</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// });</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # mod my_crate { pub fn parse(_key: &str, _value: &str) -> Result<(), ()> { unimplemented!() } }</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ## Arbitrary Input Types</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The input is a `&[u8]` slice by default, but you can take arbitrary input</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// types, as long as the type implements [the `arbitrary` crate's `Arbitrary`</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// trait](https://docs.rs/arbitrary/*/arbitrary/trait.Arbitrary.html) (which is</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// also re-exported as `libfuzzer_sys::arbitrary::Arbitrary` for convenience).</pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// For example, if you wanted to take an arbitrary RGB color, you could do the</pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// following:</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```no_run</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// #![no_main]</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # mod foo {</pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use libfuzzer_sys::{arbitrary::{Arbitrary, Error, Unstructured}, fuzz_target};</pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// #[derive(Debug)]</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// pub struct Rgb {</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// r: u8,</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// g: u8,</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// b: u8,</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// impl<'a> Arbitrary<'a> for Rgb {</pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fn arbitrary(raw: &mut Unstructured<'a>) -> Result<Self, Error> {</pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut buf = [0; 3];</pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// raw.fill_buffer(&mut buf)?;</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let r = buf[0];</pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let g = buf[1];</pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let b = buf[2];</pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Ok(Rgb { r, g, b })</pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Write a fuzz target that works with RGB colors instead of raw bytes.</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fuzz_target!(|color: Rgb| {</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// my_crate::convert_color(color);</pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// });</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # mod my_crate {</pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # use super::Rgb;</pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # pub fn convert_color(_: Rgb) {}</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # }</pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # }</pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// You can also enable the `arbitrary` crate's custom derive via this crate's</pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// `"arbitrary-derive"` cargo feature.</pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[macro_export]</pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>macro_rules! fuzz_target {</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (|$bytes:ident| $body:expr) => {</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const _: () = {</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Auto-generated function</pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[no_mangle]</pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub extern "C" fn rust_fuzzer_test_input(bytes: &[u8]) -> i32 {</pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // When `RUST_LIBFUZZER_DEBUG_PATH` is set, write the debug</pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // formatting of the input to that file. This is only intended for</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `cargo fuzz`'s use!</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `RUST_LIBFUZZER_DEBUG_PATH` is set in initialization.</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if let Some(<span class='red'>path</span>) = $crate::RUST_LIBFUZZER_DEBUG_PATH.get() {</pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use std::io::Write;</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut file = std::fs::File::create(path)</span></pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .expect("failed to create `RUST_LIBFUZZER_DEBUG_PATH` file");</span></pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> writeln!(&mut file, "{:?}", bytes)</span></pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .expect("failed to write to `RUST_LIBFUZZER_DEBUG_PATH` file");</span></pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return 0</span>;</pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> __libfuzzer_sys_run(bytes);</pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> 0</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Split out the actual fuzzer into a separate function which is</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // tagged as never being inlined. This ensures that if the fuzzer</pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // panics there's at least one stack frame which is named uniquely</pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // according to this specific fuzzer that this is embedded within.</pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Systems like oss-fuzz try to deduplicate crashes and without this</pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // panics in separate fuzzers can accidentally appear the same</pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // because each fuzzer will have a function called</pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `rust_fuzzer_test_input`. By using a normal Rust function here</pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // it's named something like `the_fuzzer_name::_::__libfuzzer_sys_run` which should</pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // ideally help prevent oss-fuzz from deduplicate fuzz bugs across</pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // distinct targets accidentally.</pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(never)]</pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn __libfuzzer_sys_run($bytes: &[u8]) {</pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> $body</pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (|$data:ident: &[u8]| $body:expr) => {</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $crate::fuzz_target!(|$data| $body);</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (|$data:ident: $dty:ty| $body:expr) => {</pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $crate::fuzz_target!(|$data: $dty| -> () { $body });</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (|$data:ident: $dty:ty| -> $rty:ty $body:block) => {</pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const _: () = {</pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Auto-generated function</pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[no_mangle]</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub extern "C" fn rust_fuzzer_test_input(bytes: &[u8]) -> i32 {</pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use $crate::arbitrary::{Arbitrary, Unstructured};</pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Early exit if we don't have enough bytes for the `Arbitrary`</pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // implementation. This helps the fuzzer avoid exploring all the</pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // different not-enough-input-bytes paths inside the `Arbitrary`</pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // implementation. Additionally, it exits faster, letting the fuzzer</pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // get to longer inputs that actually lead to interesting executions</pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // quicker.</pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if bytes.len() < <$dty as Arbitrary>::size_hint(0).0 {</pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return -1;</pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut u = Unstructured::new(bytes);</pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let data = <$dty as Arbitrary>::arbitrary_take_rest(u);</pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // When `RUST_LIBFUZZER_DEBUG_PATH` is set, write the debug</pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // formatting of the input to that file. This is only intended for</pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `cargo fuzz`'s use!</pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `RUST_LIBFUZZER_DEBUG_PATH` is set in initialization.</pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if let Some(path) = $crate::RUST_LIBFUZZER_DEBUG_PATH.get() {</pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use std::io::Write;</pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut file = std::fs::File::create(path)</pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> .expect("failed to create `RUST_LIBFUZZER_DEBUG_PATH` file");</pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (match data {</pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(data) => writeln!(&mut file, "{:#?}", data),</pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Err(err) => writeln!(&mut file, "Arbitrary Error: {}", err),</pre></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> .expect("failed to write to `RUST_LIBFUZZER_DEBUG_PATH` file");</pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return -1;</pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let data = match data {</pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(d) => d,</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Err(_) => return -1,</pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let result = ::libfuzzer_sys::Corpus::from(__libfuzzer_sys_run(data));</pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result.to_libfuzzer_code()</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // See above for why this is split to a separate function.</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(never)]</pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn __libfuzzer_sys_run($data: $dty) -> $rty {</pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $body</pre></td></tr><tr><td class='line-number'><a name='L305' href='#L305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L306' href='#L306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L307' href='#L307'><pre>307</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L308' href='#L308'><pre>308</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L309' href='#L309'><pre>309</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L310' href='#L310'><pre>310</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Define a custom mutator.</pre></td></tr><tr><td class='line-number'><a name='L311' href='#L311'><pre>311</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L312' href='#L312'><pre>312</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This is optional, and libFuzzer will use its own, default mutation strategy</pre></td></tr><tr><td class='line-number'><a name='L313' href='#L313'><pre>313</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if this is not provided.</pre></td></tr><tr><td class='line-number'><a name='L314' href='#L314'><pre>314</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L315' href='#L315'><pre>315</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// You might consider using a custom mutator when your fuzz target is very</pre></td></tr><tr><td class='line-number'><a name='L316' href='#L316'><pre>316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// particular about the shape of its input:</pre></td></tr><tr><td class='line-number'><a name='L317' href='#L317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L318' href='#L318'><pre>318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// * You want to fuzz "deeper" than just the parser.</pre></td></tr><tr><td class='line-number'><a name='L319' href='#L319'><pre>319</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// * The input contains checksums that have to match the hash of some subset of</pre></td></tr><tr><td class='line-number'><a name='L320' href='#L320'><pre>320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the data or else the whole thing is invalid, and therefore mutating any of</pre></td></tr><tr><td class='line-number'><a name='L321' href='#L321'><pre>321</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// that subset means you need to recompute the checksums.</pre></td></tr><tr><td class='line-number'><a name='L322' href='#L322'><pre>322</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// * Small random changes to the input buffer make it invalid.</pre></td></tr><tr><td class='line-number'><a name='L323' href='#L323'><pre>323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L324' href='#L324'><pre>324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// That is, a custom mutator is useful in similar situations where [a `T:</pre></td></tr><tr><td class='line-number'><a name='L325' href='#L325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Arbitrary` input type](macro.fuzz_target.html#arbitrary-input-types) is</pre></td></tr><tr><td class='line-number'><a name='L326' href='#L326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// useful. Note that the two approaches are not mutually exclusive; you can use</pre></td></tr><tr><td class='line-number'><a name='L327' href='#L327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// whichever is easier for your problem domain or both!</pre></td></tr><tr><td class='line-number'><a name='L328' href='#L328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L329' href='#L329'><pre>329</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ## Implementation Contract</pre></td></tr><tr><td class='line-number'><a name='L330' href='#L330'><pre>330</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L331' href='#L331'><pre>331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The original, unmodified input is given in `data[..size]`.</pre></td></tr><tr><td class='line-number'><a name='L332' href='#L332'><pre>332</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L333' href='#L333'><pre>333</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// You must modify the data in place and return the new size.</pre></td></tr><tr><td class='line-number'><a name='L334' href='#L334'><pre>334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L335' href='#L335'><pre>335</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The new size should not be greater than `max_size`. If this is not the case,</pre></td></tr><tr><td class='line-number'><a name='L336' href='#L336'><pre>336</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// then the `data` will be truncated to fit within `max_size`. Note that</pre></td></tr><tr><td class='line-number'><a name='L337' href='#L337'><pre>337</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// `max_size < size` is possible when shrinking test cases.</pre></td></tr><tr><td class='line-number'><a name='L338' href='#L338'><pre>338</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L339' href='#L339'><pre>339</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// You must produce the same mutation given the same `seed`. Generally, when</pre></td></tr><tr><td class='line-number'><a name='L340' href='#L340'><pre>340</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// choosing what kind of mutation to make or where to mutate, you should start</pre></td></tr><tr><td class='line-number'><a name='L341' href='#L341'><pre>341</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// by creating a random number generator (RNG) that is seeded with the given</pre></td></tr><tr><td class='line-number'><a name='L342' href='#L342'><pre>342</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// `seed` and then consult the RNG whenever making a decision:</pre></td></tr><tr><td class='line-number'><a name='L343' href='#L343'><pre>343</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L344' href='#L344'><pre>344</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```no_run</pre></td></tr><tr><td class='line-number'><a name='L345' href='#L345'><pre>345</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// #![no_main]</pre></td></tr><tr><td class='line-number'><a name='L346' href='#L346'><pre>346</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L347' href='#L347'><pre>347</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use rand::{rngs::StdRng, Rng, SeedableRng};</pre></td></tr><tr><td class='line-number'><a name='L348' href='#L348'><pre>348</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L349' href='#L349'><pre>349</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// libfuzzer_sys::fuzz_mutator!(|data: &mut [u8], size: usize, max_size: usize, seed: u32| {</pre></td></tr><tr><td class='line-number'><a name='L350' href='#L350'><pre>350</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut rng = StdRng::seed_from_u64(seed as u64);</pre></td></tr><tr><td class='line-number'><a name='L351' href='#L351'><pre>351</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L352' href='#L352'><pre>352</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # let first_mutation = |_, _, _, _| todo!();</pre></td></tr><tr><td class='line-number'><a name='L353' href='#L353'><pre>353</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # let second_mutation = |_, _, _, _| todo!();</pre></td></tr><tr><td class='line-number'><a name='L354' href='#L354'><pre>354</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # let third_mutation = |_, _, _, _| todo!();</pre></td></tr><tr><td class='line-number'><a name='L355' href='#L355'><pre>355</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # let fourth_mutation = |_, _, _, _| todo!();</pre></td></tr><tr><td class='line-number'><a name='L356' href='#L356'><pre>356</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Choose which of our four supported kinds of mutations we want to make.</pre></td></tr><tr><td class='line-number'><a name='L357' href='#L357'><pre>357</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// match rng.gen_range(0..4) {</pre></td></tr><tr><td class='line-number'><a name='L358' href='#L358'><pre>358</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 0 => first_mutation(rng, data, size, max_size),</pre></td></tr><tr><td class='line-number'><a name='L359' href='#L359'><pre>359</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 1 => second_mutation(rng, data, size, max_size),</pre></td></tr><tr><td class='line-number'><a name='L360' href='#L360'><pre>360</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 2 => third_mutation(rng, data, size, max_size),</pre></td></tr><tr><td class='line-number'><a name='L361' href='#L361'><pre>361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 3 => fourth_mutation(rng, data, size, max_size),</pre></td></tr><tr><td class='line-number'><a name='L362' href='#L362'><pre>362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// _ => unreachable!()</pre></td></tr><tr><td class='line-number'><a name='L363' href='#L363'><pre>363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L364' href='#L364'><pre>364</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// });</pre></td></tr><tr><td class='line-number'><a name='L365' href='#L365'><pre>365</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L366' href='#L366'><pre>366</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L367' href='#L367'><pre>367</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ## Example: Compression</pre></td></tr><tr><td class='line-number'><a name='L368' href='#L368'><pre>368</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L369' href='#L369'><pre>369</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Consider a simple fuzz target that takes compressed data as input,</pre></td></tr><tr><td class='line-number'><a name='L370' href='#L370'><pre>370</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// decompresses it, and then asserts that the decompressed data doesn't begin</pre></td></tr><tr><td class='line-number'><a name='L371' href='#L371'><pre>371</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// with "boom". It is difficult for `libFuzzer` (or any other fuzzer) to crash</pre></td></tr><tr><td class='line-number'><a name='L372' href='#L372'><pre>372</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// this fuzz target because nearly all mutations it makes will invalidate the</pre></td></tr><tr><td class='line-number'><a name='L373' href='#L373'><pre>373</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// compression format. Therefore, we use a custom mutator that decompresses the</pre></td></tr><tr><td class='line-number'><a name='L374' href='#L374'><pre>374</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// raw input, mutates the decompressed data, and then recompresses it. This</pre></td></tr><tr><td class='line-number'><a name='L375' href='#L375'><pre>375</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// allows `libFuzzer` to quickly discover crashing inputs.</pre></td></tr><tr><td class='line-number'><a name='L376' href='#L376'><pre>376</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L377' href='#L377'><pre>377</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```no_run</pre></td></tr><tr><td class='line-number'><a name='L378' href='#L378'><pre>378</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// #![no_main]</pre></td></tr><tr><td class='line-number'><a name='L379' href='#L379'><pre>379</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L380' href='#L380'><pre>380</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use flate2::{read::GzDecoder, write::GzEncoder, Compression};</pre></td></tr><tr><td class='line-number'><a name='L381' href='#L381'><pre>381</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use libfuzzer_sys::{fuzz_mutator, fuzz_target};</pre></td></tr><tr><td class='line-number'><a name='L382' href='#L382'><pre>382</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use std::io::{Read, Write};</pre></td></tr><tr><td class='line-number'><a name='L383' href='#L383'><pre>383</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L384' href='#L384'><pre>384</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fuzz_target!(|data: &[u8]| {</pre></td></tr><tr><td class='line-number'><a name='L385' href='#L385'><pre>385</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Decompress the input data and crash if it starts with "boom".</pre></td></tr><tr><td class='line-number'><a name='L386' href='#L386'><pre>386</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if let Some(data) = decompress(data) {</pre></td></tr><tr><td class='line-number'><a name='L387' href='#L387'><pre>387</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if data.starts_with(b"boom") {</pre></td></tr><tr><td class='line-number'><a name='L388' href='#L388'><pre>388</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// panic!();</pre></td></tr><tr><td class='line-number'><a name='L389' href='#L389'><pre>389</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L390' href='#L390'><pre>390</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L391' href='#L391'><pre>391</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// });</pre></td></tr><tr><td class='line-number'><a name='L392' href='#L392'><pre>392</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L393' href='#L393'><pre>393</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fuzz_mutator!(</pre></td></tr><tr><td class='line-number'><a name='L394' href='#L394'><pre>394</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// |data: &mut [u8], size: usize, max_size: usize, _seed: u32| {</pre></td></tr><tr><td class='line-number'><a name='L395' href='#L395'><pre>395</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Decompress the input data. If that fails, use a dummy value.</pre></td></tr><tr><td class='line-number'><a name='L396' href='#L396'><pre>396</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut decompressed = decompress(&data[..size]).unwrap_or_else(|| b"hi".to_vec());</pre></td></tr><tr><td class='line-number'><a name='L397' href='#L397'><pre>397</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Mutate the decompressed data with `libFuzzer`'s default mutator. Make</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // the `decompressed` vec's extra capacity available for insertion</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // mutations via `resize`.</pre></td></tr><tr><td class='line-number'><a name='L401' href='#L401'><pre>401</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let len = decompressed.len();</pre></td></tr><tr><td class='line-number'><a name='L402' href='#L402'><pre>402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let cap = decompressed.capacity();</pre></td></tr><tr><td class='line-number'><a name='L403' href='#L403'><pre>403</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// decompressed.resize(cap, 0);</pre></td></tr><tr><td class='line-number'><a name='L404' href='#L404'><pre>404</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let new_decompressed_size = libfuzzer_sys::fuzzer_mutate(&mut decompressed, len, cap);</pre></td></tr><tr><td class='line-number'><a name='L405' href='#L405'><pre>405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L406' href='#L406'><pre>406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Recompress the mutated data.</pre></td></tr><tr><td class='line-number'><a name='L407' href='#L407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let compressed = compress(&decompressed[..new_decompressed_size]);</pre></td></tr><tr><td class='line-number'><a name='L408' href='#L408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L409' href='#L409'><pre>409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Copy the recompressed mutated data into `data` and return the new size.</pre></td></tr><tr><td class='line-number'><a name='L410' href='#L410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let new_size = std::cmp::min(max_size, compressed.len());</pre></td></tr><tr><td class='line-number'><a name='L411' href='#L411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// data[..new_size].copy_from_slice(&compressed[..new_size]);</pre></td></tr><tr><td class='line-number'><a name='L412' href='#L412'><pre>412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// new_size</pre></td></tr><tr><td class='line-number'><a name='L413' href='#L413'><pre>413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L414' href='#L414'><pre>414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// );</pre></td></tr><tr><td class='line-number'><a name='L415' href='#L415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L416' href='#L416'><pre>416</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fn decompress(compressed_data: &[u8]) -> Option<Vec<u8>> {</pre></td></tr><tr><td class='line-number'><a name='L417' href='#L417'><pre>417</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut decoder = GzDecoder::new(compressed_data);</pre></td></tr><tr><td class='line-number'><a name='L418' href='#L418'><pre>418</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut decompressed = Vec::new();</pre></td></tr><tr><td class='line-number'><a name='L419' href='#L419'><pre>419</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if decoder.read_to_end(&mut decompressed).is_ok() {</pre></td></tr><tr><td class='line-number'><a name='L420' href='#L420'><pre>420</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Some(decompressed)</pre></td></tr><tr><td class='line-number'><a name='L421' href='#L421'><pre>421</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// } else {</pre></td></tr><tr><td class='line-number'><a name='L422' href='#L422'><pre>422</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// None</pre></td></tr><tr><td class='line-number'><a name='L423' href='#L423'><pre>423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L424' href='#L424'><pre>424</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// fn compress(data: &[u8]) -> Vec<u8> {</pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut encoder = GzEncoder::new(Vec::new(), Compression::default());</pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// encoder</pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// .write_all(data)</pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// .expect("writing into a vec is infallible");</pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// encoder.finish().expect("writing into a vec is infallible")</pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// }</pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L434' href='#L434'><pre>434</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L435' href='#L435'><pre>435</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This example is inspired by [a similar example from the official `libFuzzer`</pre></td></tr><tr><td class='line-number'><a name='L436' href='#L436'><pre>436</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// docs](https://github.com/google/fuzzing/blob/master/docs/structure-aware-fuzzing.md#example-compression).</pre></td></tr><tr><td class='line-number'><a name='L437' href='#L437'><pre>437</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L438' href='#L438'><pre>438</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ## More Example Ideas</pre></td></tr><tr><td class='line-number'><a name='L439' href='#L439'><pre>439</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L440' href='#L440'><pre>440</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// * A PNG custom mutator that decodes a PNG, mutates the image, and then</pre></td></tr><tr><td class='line-number'><a name='L441' href='#L441'><pre>441</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// re-encodes the mutated image as a new PNG.</pre></td></tr><tr><td class='line-number'><a name='L442' href='#L442'><pre>442</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L443' href='#L443'><pre>443</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// * A [`serde`](https://serde.rs/) custom mutator that deserializes your</pre></td></tr><tr><td class='line-number'><a name='L444' href='#L444'><pre>444</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// structure, mutates it, and then reserializes it.</pre></td></tr><tr><td class='line-number'><a name='L445' href='#L445'><pre>445</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L446' href='#L446'><pre>446</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// * A Wasm binary custom mutator that inserts, replaces, and removes a</pre></td></tr><tr><td class='line-number'><a name='L447' href='#L447'><pre>447</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// bytecode instruction in a function's body.</pre></td></tr><tr><td class='line-number'><a name='L448' href='#L448'><pre>448</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L449' href='#L449'><pre>449</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// * An HTTP request custom mutator that inserts, replaces, and removes a</pre></td></tr><tr><td class='line-number'><a name='L450' href='#L450'><pre>450</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// header from an HTTP request.</pre></td></tr><tr><td class='line-number'><a name='L451' href='#L451'><pre>451</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[macro_export]</pre></td></tr><tr><td class='line-number'><a name='L452' href='#L452'><pre>452</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>macro_rules! fuzz_mutator {</pre></td></tr><tr><td class='line-number'><a name='L453' href='#L453'><pre>453</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (</pre></td></tr><tr><td class='line-number'><a name='L454' href='#L454'><pre>454</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> |</pre></td></tr><tr><td class='line-number'><a name='L455' href='#L455'><pre>455</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $data:ident : &mut [u8] ,</pre></td></tr><tr><td class='line-number'><a name='L456' href='#L456'><pre>456</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $size:ident : usize ,</pre></td></tr><tr><td class='line-number'><a name='L457' href='#L457'><pre>457</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $max_size:ident : usize ,</pre></td></tr><tr><td class='line-number'><a name='L458' href='#L458'><pre>458</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $seed:ident : u32 $(,)*</pre></td></tr><tr><td class='line-number'><a name='L459' href='#L459'><pre>459</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> |</pre></td></tr><tr><td class='line-number'><a name='L460' href='#L460'><pre>460</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $body:block</pre></td></tr><tr><td class='line-number'><a name='L461' href='#L461'><pre>461</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ) => {</pre></td></tr><tr><td class='line-number'><a name='L462' href='#L462'><pre>462</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Auto-generated function.</pre></td></tr><tr><td class='line-number'><a name='L463' href='#L463'><pre>463</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[export_name = "LLVMFuzzerCustomMutator"]</pre></td></tr><tr><td class='line-number'><a name='L464' href='#L464'><pre>464</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn rust_fuzzer_custom_mutator(</pre></td></tr><tr><td class='line-number'><a name='L465' href='#L465'><pre>465</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $data: *mut u8,</pre></td></tr><tr><td class='line-number'><a name='L466' href='#L466'><pre>466</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $size: usize,</pre></td></tr><tr><td class='line-number'><a name='L467' href='#L467'><pre>467</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $max_size: usize,</pre></td></tr><tr><td class='line-number'><a name='L468' href='#L468'><pre>468</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $seed: std::os::raw::c_uint,</pre></td></tr><tr><td class='line-number'><a name='L469' href='#L469'><pre>469</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ) -> usize {</pre></td></tr><tr><td class='line-number'><a name='L470' href='#L470'><pre>470</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Depending on if we are growing or shrinking the test case, `size`</pre></td></tr><tr><td class='line-number'><a name='L471' href='#L471'><pre>471</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // might be larger or smaller than `max_size`. The `data`'s capacity</pre></td></tr><tr><td class='line-number'><a name='L472' href='#L472'><pre>472</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // is the maximum of the two.</pre></td></tr><tr><td class='line-number'><a name='L473' href='#L473'><pre>473</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let len = std::cmp::max($max_size, $size);</pre></td></tr><tr><td class='line-number'><a name='L474' href='#L474'><pre>474</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let $data: &mut [u8] = unsafe { std::slice::from_raw_parts_mut($data, len) };</pre></td></tr><tr><td class='line-number'><a name='L475' href='#L475'><pre>475</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L476' href='#L476'><pre>476</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `unsigned int` is generally a `u32`, but not on all targets. Do</pre></td></tr><tr><td class='line-number'><a name='L477' href='#L477'><pre>477</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // an infallible (and potentially lossy, but that's okay because it</pre></td></tr><tr><td class='line-number'><a name='L478' href='#L478'><pre>478</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // preserves determinism) conversion.</pre></td></tr><tr><td class='line-number'><a name='L479' href='#L479'><pre>479</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let $seed = $seed as u32;</pre></td></tr><tr><td class='line-number'><a name='L480' href='#L480'><pre>480</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L481' href='#L481'><pre>481</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Truncate the new size if it is larger than the max.</pre></td></tr><tr><td class='line-number'><a name='L482' href='#L482'><pre>482</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let new_size = { $body };</pre></td></tr><tr><td class='line-number'><a name='L483' href='#L483'><pre>483</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> std::cmp::min(new_size, $max_size)</pre></td></tr><tr><td class='line-number'><a name='L484' href='#L484'><pre>484</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L485' href='#L485'><pre>485</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L486' href='#L486'><pre>486</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L487' href='#L487'><pre>487</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L488' href='#L488'><pre>488</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The default `libFuzzer` mutator.</pre></td></tr><tr><td class='line-number'><a name='L489' href='#L489'><pre>489</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L490' href='#L490'><pre>490</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// You generally don't have to use this at all unless you're defining a</pre></td></tr><tr><td class='line-number'><a name='L491' href='#L491'><pre>491</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// custom mutator with [the `fuzz_mutator!` macro][crate::fuzz_mutator].</pre></td></tr><tr><td class='line-number'><a name='L492' href='#L492'><pre>492</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L493' href='#L493'><pre>493</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Mutates `data[..size]` in place such that the mutated data is no larger than</pre></td></tr><tr><td class='line-number'><a name='L494' href='#L494'><pre>494</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// `max_size` and returns the new size of the mutated data.</pre></td></tr><tr><td class='line-number'><a name='L495' href='#L495'><pre>495</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L496' href='#L496'><pre>496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// To only allow shrinking mutations, make `max_size < size`.</pre></td></tr><tr><td class='line-number'><a name='L497' href='#L497'><pre>497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L498' href='#L498'><pre>498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// To additionally allow mutations that grow the size of the data, make</pre></td></tr><tr><td class='line-number'><a name='L499' href='#L499'><pre>499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// `max_size > size`.</pre></td></tr><tr><td class='line-number'><a name='L500' href='#L500'><pre>500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L501' href='#L501'><pre>501</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Both `size` and `max_size` must be less than or equal to `data.len()`.</pre></td></tr><tr><td class='line-number'><a name='L502' href='#L502'><pre>502</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L503' href='#L503'><pre>503</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Example</pre></td></tr><tr><td class='line-number'><a name='L504' href='#L504'><pre>504</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L505' href='#L505'><pre>505</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```no_run</pre></td></tr><tr><td class='line-number'><a name='L506' href='#L506'><pre>506</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Create some data in a buffer.</pre></td></tr><tr><td class='line-number'><a name='L507' href='#L507'><pre>507</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mut data = vec![0; 128];</pre></td></tr><tr><td class='line-number'><a name='L508' href='#L508'><pre>508</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// data[..b"hello".len()].copy_from_slice(b"hello");</pre></td></tr><tr><td class='line-number'><a name='L509' href='#L509'><pre>509</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L510' href='#L510'><pre>510</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Ask `libFuzzer` to mutate the data. By setting `max_size` to our buffer's</pre></td></tr><tr><td class='line-number'><a name='L511' href='#L511'><pre>511</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // full length, we are allowing `libFuzzer` to perform mutations that grow</pre></td></tr><tr><td class='line-number'><a name='L512' href='#L512'><pre>512</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // the size of the data, such as insertions.</pre></td></tr><tr><td class='line-number'><a name='L513' href='#L513'><pre>513</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let size = b"hello".len();</pre></td></tr><tr><td class='line-number'><a name='L514' href='#L514'><pre>514</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let max_size = data.len();</pre></td></tr><tr><td class='line-number'><a name='L515' href='#L515'><pre>515</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let new_size = libfuzzer_sys::fuzzer_mutate(&mut data, size, max_size);</pre></td></tr><tr><td class='line-number'><a name='L516' href='#L516'><pre>516</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L517' href='#L517'><pre>517</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// // Get the mutated data out of the buffer.</pre></td></tr><tr><td class='line-number'><a name='L518' href='#L518'><pre>518</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// let mutated_data = &data[..new_size];</pre></td></tr><tr><td class='line-number'><a name='L519' href='#L519'><pre>519</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ```</pre></td></tr><tr><td class='line-number'><a name='L520' href='#L520'><pre>520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>pub fn fuzzer_mutate(data: &mut [u8], size: usize, max_size: usize) -> usize {</span></pre></td></tr><tr><td class='line-number'><a name='L521' href='#L521'><pre>521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert!(size <= data.len())</span>;</pre></td></tr><tr><td class='line-number'><a name='L522' href='#L522'><pre>522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>assert!(max_size <= data.len())</span>;</pre></td></tr><tr><td class='line-number'><a name='L523' href='#L523'><pre>523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>new_size = unsafe { LLVMFuzzerMutate(data.as_mut_ptr(), size, max_size) };</span></pre></td></tr><tr><td class='line-number'><a name='L524' href='#L524'><pre>524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert!(new_size <= data.len())</span>;</pre></td></tr><tr><td class='line-number'><a name='L525' href='#L525'><pre>525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>new_size</span></pre></td></tr><tr><td class='line-number'><a name='L526' href='#L526'><pre>526</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.18.0/src/imp_std.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L13'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// There's a lot of scary concurrent code in this module, but it is copied from</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// `std::sync::Once` with two changes:</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// * no poisoning</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// * init function can fail</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use std::{</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cell::{Cell, UnsafeCell},</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> panic::{RefUnwindSafe, UnwindSafe},</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> sync::atomic::{AtomicBool, AtomicPtr, Ordering},</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> thread::{self, Thread},</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>};</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Debug</span>)]</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub(crate) struct OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // This `queue` field is the core of the implementation. It encodes two</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // pieces of information:</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // * The current state of the cell (`INCOMPLETE`, `RUNNING`, `COMPLETE`)</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // * Linked list of threads waiting for the current cell.</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // State is encoded in two low bits. Only `INCOMPLETE` and `RUNNING` states</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // allow waiters.</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> queue: AtomicPtr<Waiter>,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> value: UnsafeCell<Option<T>>,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Why do we need `T: Send`?</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Thread A creates a `OnceCell` and shares it with</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// scoped thread B, which fills the cell, which is</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// then destroyed by A. That is, destructor observes</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// a sent value.</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>unsafe impl<T: Sync + Send> Sync for OnceCell<T> {}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>unsafe impl<T: Send> Send for OnceCell<T> {}</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T: RefUnwindSafe + UnwindSafe> RefUnwindSafe for OnceCell<T> {}</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T: UnwindSafe> UnwindSafe for OnceCell<T> {}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<T> OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) const fn new() -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceCell { queue: AtomicPtr::new(INCOMPLETE_PTR), value: UnsafeCell::new(None) }</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) const fn with_value(value: T) -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceCell { queue: AtomicPtr::new(COMPLETE_PTR), value: UnsafeCell::new(Some(value)) }</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Safety: synchronizes with store to value via Release/(Acquire|SeqCst).</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn is_initialized(&self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // An `Acquire` load is enough because that makes all the initialization</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // operations visible to us, and, this being a fast path, weaker</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // ordering helps with performance. This `Acquire` synchronizes with</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // `SeqCst` operations on the slow path.</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.queue.load(Ordering::Acquire) == COMPLETE_PTR</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE14is_initializedCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn is_initialized(&self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // An `Acquire` load is enough because that makes all the initialization</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // operations visible to us, and, this being a fast path, weaker</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // ordering helps with performance. This `Acquire` synchronizes with</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> // `SeqCst` operations on the slow path.</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.queue.load(Ordering::Acquire) == COMPLETE_PTR</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE14is_initializedCsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB5_8OnceCellpE14is_initializedB7_</pre></div></div></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Safety: synchronizes with store to value via SeqCst read from state,</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// writes value only once because we never get to INCOMPLETE state after a</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// successful write.</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[cold]</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn initialize<F, E>(&self, f: F) -> Result<(), E></span></pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> Result<T, E>,</span></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut f = Some(f);</span></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut res: Result<(), E> = Ok(());</span></pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let slot: *mut Option<T> = self.value.get();</span></pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> initialize_or_wait(</span></pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &self.queue,</span></pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Some(&mut </span>|| <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let f = unsafe { f.take().unwrap_unchecked() };</span></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match f()</span> {</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(<span class='red'>value) => {</span></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsafe { *slot = Some(value) };</span></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> true</span></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Err(<span class='red'>err) => {</span></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> res = Err(err);</span></pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> false</span></pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span><span class='red'>),</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNCINvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB8_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE10initializeNCINvMs4_NtBa_4syncINtB1P_8OnceCellBR_E11get_or_initNCNvB1L_10try_insert0E0NtNvMs4_B1P_IB20_pE11get_or_init4VoidE0Csi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNCINvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB8_8OnceCellpE10initializeppE0Ba_</pre></div></div></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> );</span></pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> res</span></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB6_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE10initializeNCINvMs4_NtB8_4syncINtB1N_8OnceCellBP_E11get_or_initNCNvB1J_10try_insert0E0NtNvMs4_B1N_IB1Y_pE11get_or_init4VoidECsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB6_8OnceCellpE10initializeppEB8_</pre></div></div></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[cold]</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn wait(&self) {</span></pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> initialize_or_wait(&self.queue, None);</span></pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Get the reference to the underlying value, without checking if the cell</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// is initialized.</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Safety</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Caller must ensure that the cell is in initialized state, and that</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the contents are acquired by (synchronized to) this thread.</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) unsafe fn get_unchecked(&self) -> &T </span>{</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> debug_assert!(<span class='red'>self.is_initialized()</span>);</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>slot = &*self.value.get();</span></pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> slot.as_ref().unwrap_unchecked()</span></pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE13get_uncheckedCsgg978DXfVXR_13fuzz_target_1</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE13get_uncheckedCsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs2_NtCsaBdG7DIvBl9_9once_cell3impINtB5_8OnceCellpE13get_uncheckedB7_</pre></div></div></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the mutable reference to the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `None` if the cell is empty.</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn get_mut(&mut self) -> Option<&mut T> {</span></pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Safe b/c we have a unique access.</span></pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsafe { &mut *self.value.get() }.as_mut()</span></pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Consumes this `OnceCell`, returning the wrapped value.</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `None` if the cell was empty.</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn into_inner(self) -> Option<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Because `into_inner` takes `self` by value, the compiler statically</span></pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // verifies that it is not currently borrowed.</span></pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // So, it is safe to move out `Option<T>`.</span></pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.value.into_inner()</span></pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Three states that a OnceCell can be in, encoded into the lower bits of `queue` in</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// the OnceCell structure.</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const INCOMPLETE: usize = 0x0;</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const RUNNING: usize = 0x1;</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const COMPLETE: usize = 0x2;</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const INCOMPLETE_PTR: *mut Waiter = INCOMPLETE as *mut Waiter;</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const COMPLETE_PTR: *mut Waiter = COMPLETE as *mut Waiter;</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Mask to learn about the state. All other bits are the queue of waiters if</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// this is in the RUNNING state.</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const STATE_MASK: usize = 0x3;</pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Representation of a node in the linked list of waiters in the RUNNING state.</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A waiters is stored on the stack of the waiting threads.</pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[repr(align(4))] // Ensure the two lower bits are free to use as state bits.</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>struct Waiter {</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> thread: Cell<Option<Thread>>,</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signaled: AtomicBool,</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> next: *mut Waiter,</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Drains and notifies the queue of waiters on drop.</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>struct Guard<'a> {</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> queue: &'a AtomicPtr<Waiter>,</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> new_queue: *mut Waiter,</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl Drop for Guard<'_> {</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn drop(&mut self) {</span></pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let queue = self.queue.swap(self.new_queue, Ordering::AcqRel);</span></pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let state = strict::addr(queue) & STATE_MASK;</span></pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert_eq!(state, RUNNING)</span>;</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut waiter = strict::map_addr(queue, </span>|q| <span class='red'>q & !STATE_MASK</span><span class='red'>)</span>;</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> while <span class='red'>!waiter.is_null()</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let next = (*waiter).next;</span></pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let thread = (*waiter).thread.take().unwrap();</span></pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> (*waiter).signaled.store(true, Ordering::Release);</span></pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> waiter = next;</span></pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> thread.unpark();</span></pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Corresponds to `std::sync::Once::call_inner`.</pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Originally copied from std, but since modified to remove poisoning and to</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// support wait.</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Note: this is intentionally monomorphic</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[inline(never)]</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>fn initialize_or_wait(queue: &AtomicPtr<Waiter>, mut init: Option<&mut dyn FnMut() -> bool>) {</span></pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut curr_queue = queue.load(Ordering::Acquire)</span>;</pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>loop {</span></pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let curr_state = strict::addr(curr_queue) & STATE_MASK;</span></pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match (curr_state, &mut init</span>) {</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (COMPLETE, _) => <span class='red'>return</span>,</pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (INCOMPLETE, Some(<span class='red'>init)) => {</span></pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let exchange = queue.compare_exchange(</span></pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> curr_queue,</span></pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> strict::map_addr(curr_queue, </span>|q| <span class='red'>(q & !STATE_MASK) | RUNNING</span><span class='red'>),</span></pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::Acquire,</span></pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::Acquire,</span></pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> )</span>;</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Err(<span class='red'>new_queue</span>) = <span class='red'>exchange</span> {</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>curr_queue = new_queue;</span></pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue</span>;</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut guard = Guard { queue, new_queue: INCOMPLETE_PTR };</span></pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if init()</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> guard.new_queue = COMPLETE_PTR;</span></pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return</span>;</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (INCOMPLETE, None) | (RUNNING, _) => <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> wait(queue, curr_queue);</span></pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> curr_queue = queue.load(Ordering::Acquire);</span></pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> _ => <span class='red'>debug_assert!(false)</span>,</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>fn wait(queue: &AtomicPtr<Waiter>, mut curr_queue: *mut Waiter) {</span></pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let curr_state = strict::addr(curr_queue) & STATE_MASK</span>;</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>loop {</span></pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let node = Waiter {</span></pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> thread: Cell::new(Some(thread::current())),</span></pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> signaled: AtomicBool::new(false),</span></pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> next: strict::map_addr(curr_queue, </span>|q| <span class='red'>q & !STATE_MASK</span><span class='red'>),</span></pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> };</span></pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let me = &node as *const Waiter as *mut Waiter;</span></pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let exchange = queue.compare_exchange(</span></pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> curr_queue,</span></pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> strict::map_addr(me, </span>|q| <span class='red'>q | curr_state</span><span class='red'>),</span></pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::Release,</span></pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::Relaxed,</span></pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> )</span>;</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Err(<span class='red'>new_queue</span>) = <span class='red'>exchange</span> {</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>strict::addr(new_queue) & STATE_MASK != curr_state</span> {</pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return</span>;</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> curr_queue = new_queue;</span></pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue</span>;</pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> while <span class='red'>!node.signaled.load(Ordering::Acquire)</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> thread::park();</span></pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Polyfill of strict provenance from https://crates.io/crates/sptr.</pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Use free-standing function rather than a trait to keep things simple and</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// avoid any potential conflicts with future stabile std API.</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod strict {</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[must_use]</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn addr<T>(ptr: *mut T) -> usize</span></pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> T: Sized,</span></pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.</span></pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // SAFETY: Pointer-to-integer transmutes are valid (if you are okay with losing the</span></pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // provenance).</span></pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsafe { core::mem::transmute(ptr) }</span></pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[must_use]</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn with_addr<T>(ptr: *mut T, addr: usize) -> *mut T</span></pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> T: Sized,</span></pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.</span></pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // In the mean-time, this operation is defined to be "as if" it was</span></pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // a wrapping_offset, so we can emulate it as such. This should properly</span></pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // restore pointer provenance even under today's compiler.</span></pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let self_addr = self::addr(ptr) as isize;</span></pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let dest_addr = addr as isize;</span></pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let offset = dest_addr.wrapping_sub(self_addr);</span></pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This is the canonical desugarring of this operation,</span></pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // but `pointer::cast` was only stabilized in 1.38.</span></pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // self.cast::<u8>().wrapping_offset(offset).cast::<T>()</span></pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> (ptr as *mut u8).wrapping_offset(offset) as *mut T</span></pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[must_use]</pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn map_addr<T>(ptr: *mut T, f: impl FnOnce(usize) -> usize) -> *mut T</span></pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> T: Sized,</span></pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self::with_addr(ptr, f(addr(ptr)))</span></pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvNtNtCsaBdG7DIvBl9_9once_cell3imp6strict8map_addrNtB4_6WaiterNCNvB4_18initialize_or_wait0EB6_</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvNtNtCsaBdG7DIvBl9_9once_cell3imp6strict8map_addrNtB4_6WaiterNCNvB4_4waits_0EB6_</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvNtNtCsaBdG7DIvBl9_9once_cell3imp6strict8map_addrNtB4_6WaiterNCNvB4_4wait0EB6_</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvNtNtCsaBdG7DIvBl9_9once_cell3imp6strict8map_addrNtB4_6WaiterNCNvXs3_B4_NtB4_5GuardNtNtNtCs6xNykbTfrCs_4core3ops4drop4Drop4drop0EB6_</pre></div></div></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// These test are snatched from std as well.</pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod tests {</pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use std::panic;</pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use std::{sync::mpsc::channel, thread};</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn init(&self, f: impl FnOnce() -> T) {</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> enum Void {}</pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let _ = self.initialize(|| Ok::<T, Void>(f()));</pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L305' href='#L305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn smoke_once() {</pre></td></tr><tr><td class='line-number'><a name='L306' href='#L306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> static O: OnceCell<()> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L307' href='#L307'><pre>307</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut a = 0;</pre></td></tr><tr><td class='line-number'><a name='L308' href='#L308'><pre>308</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| a += 1);</pre></td></tr><tr><td class='line-number'><a name='L309' href='#L309'><pre>309</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(a, 1);</pre></td></tr><tr><td class='line-number'><a name='L310' href='#L310'><pre>310</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| a += 1);</pre></td></tr><tr><td class='line-number'><a name='L311' href='#L311'><pre>311</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(a, 1);</pre></td></tr><tr><td class='line-number'><a name='L312' href='#L312'><pre>312</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L313' href='#L313'><pre>313</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L314' href='#L314'><pre>314</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L315' href='#L315'><pre>315</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn stampede_once() {</pre></td></tr><tr><td class='line-number'><a name='L316' href='#L316'><pre>316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> static O: OnceCell<()> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L317' href='#L317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> static mut RUN: bool = false;</pre></td></tr><tr><td class='line-number'><a name='L318' href='#L318'><pre>318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L319' href='#L319'><pre>319</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let (tx, rx) = channel();</pre></td></tr><tr><td class='line-number'><a name='L320' href='#L320'><pre>320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> for _ in 0..10 {</pre></td></tr><tr><td class='line-number'><a name='L321' href='#L321'><pre>321</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let tx = tx.clone();</pre></td></tr><tr><td class='line-number'><a name='L322' href='#L322'><pre>322</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> thread::spawn(move || {</pre></td></tr><tr><td class='line-number'><a name='L323' href='#L323'><pre>323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> for _ in 0..4 {</pre></td></tr><tr><td class='line-number'><a name='L324' href='#L324'><pre>324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> thread::yield_now()</pre></td></tr><tr><td class='line-number'><a name='L325' href='#L325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L326' href='#L326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L327' href='#L327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| {</pre></td></tr><tr><td class='line-number'><a name='L328' href='#L328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(!RUN);</pre></td></tr><tr><td class='line-number'><a name='L329' href='#L329'><pre>329</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> RUN = true;</pre></td></tr><tr><td class='line-number'><a name='L330' href='#L330'><pre>330</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L331' href='#L331'><pre>331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(RUN);</pre></td></tr><tr><td class='line-number'><a name='L332' href='#L332'><pre>332</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L333' href='#L333'><pre>333</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> tx.send(()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L334' href='#L334'><pre>334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L335' href='#L335'><pre>335</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L336' href='#L336'><pre>336</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L337' href='#L337'><pre>337</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe {</pre></td></tr><tr><td class='line-number'><a name='L338' href='#L338'><pre>338</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| {</pre></td></tr><tr><td class='line-number'><a name='L339' href='#L339'><pre>339</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(!RUN);</pre></td></tr><tr><td class='line-number'><a name='L340' href='#L340'><pre>340</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> RUN = true;</pre></td></tr><tr><td class='line-number'><a name='L341' href='#L341'><pre>341</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L342' href='#L342'><pre>342</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(RUN);</pre></td></tr><tr><td class='line-number'><a name='L343' href='#L343'><pre>343</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L344' href='#L344'><pre>344</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L345' href='#L345'><pre>345</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> for _ in 0..10 {</pre></td></tr><tr><td class='line-number'><a name='L346' href='#L346'><pre>346</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> rx.recv().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L347' href='#L347'><pre>347</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L348' href='#L348'><pre>348</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L349' href='#L349'><pre>349</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L350' href='#L350'><pre>350</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L351' href='#L351'><pre>351</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn poison_bad() {</pre></td></tr><tr><td class='line-number'><a name='L352' href='#L352'><pre>352</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> static O: OnceCell<()> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L353' href='#L353'><pre>353</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L354' href='#L354'><pre>354</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // poison the once</pre></td></tr><tr><td class='line-number'><a name='L355' href='#L355'><pre>355</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let t = panic::catch_unwind(|| {</pre></td></tr><tr><td class='line-number'><a name='L356' href='#L356'><pre>356</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| panic!());</pre></td></tr><tr><td class='line-number'><a name='L357' href='#L357'><pre>357</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L358' href='#L358'><pre>358</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(t.is_err());</pre></td></tr><tr><td class='line-number'><a name='L359' href='#L359'><pre>359</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L360' href='#L360'><pre>360</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // we can subvert poisoning, however</pre></td></tr><tr><td class='line-number'><a name='L361' href='#L361'><pre>361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut called = false;</pre></td></tr><tr><td class='line-number'><a name='L362' href='#L362'><pre>362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| {</pre></td></tr><tr><td class='line-number'><a name='L363' href='#L363'><pre>363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> called = true;</pre></td></tr><tr><td class='line-number'><a name='L364' href='#L364'><pre>364</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L365' href='#L365'><pre>365</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(called);</pre></td></tr><tr><td class='line-number'><a name='L366' href='#L366'><pre>366</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L367' href='#L367'><pre>367</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // once any success happens, we stop propagating the poison</pre></td></tr><tr><td class='line-number'><a name='L368' href='#L368'><pre>368</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| {});</pre></td></tr><tr><td class='line-number'><a name='L369' href='#L369'><pre>369</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L370' href='#L370'><pre>370</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L371' href='#L371'><pre>371</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L372' href='#L372'><pre>372</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn wait_for_force_to_finish() {</pre></td></tr><tr><td class='line-number'><a name='L373' href='#L373'><pre>373</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> static O: OnceCell<()> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L374' href='#L374'><pre>374</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L375' href='#L375'><pre>375</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // poison the once</pre></td></tr><tr><td class='line-number'><a name='L376' href='#L376'><pre>376</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let t = panic::catch_unwind(|| {</pre></td></tr><tr><td class='line-number'><a name='L377' href='#L377'><pre>377</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| panic!());</pre></td></tr><tr><td class='line-number'><a name='L378' href='#L378'><pre>378</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L379' href='#L379'><pre>379</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(t.is_err());</pre></td></tr><tr><td class='line-number'><a name='L380' href='#L380'><pre>380</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L381' href='#L381'><pre>381</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // make sure someone's waiting inside the once via a force</pre></td></tr><tr><td class='line-number'><a name='L382' href='#L382'><pre>382</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let (tx1, rx1) = channel();</pre></td></tr><tr><td class='line-number'><a name='L383' href='#L383'><pre>383</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let (tx2, rx2) = channel();</pre></td></tr><tr><td class='line-number'><a name='L384' href='#L384'><pre>384</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let t1 = thread::spawn(move || {</pre></td></tr><tr><td class='line-number'><a name='L385' href='#L385'><pre>385</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| {</pre></td></tr><tr><td class='line-number'><a name='L386' href='#L386'><pre>386</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> tx1.send(()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L387' href='#L387'><pre>387</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> rx2.recv().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L388' href='#L388'><pre>388</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L389' href='#L389'><pre>389</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L390' href='#L390'><pre>390</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L391' href='#L391'><pre>391</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> rx1.recv().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L392' href='#L392'><pre>392</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L393' href='#L393'><pre>393</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // put another waiter on the once</pre></td></tr><tr><td class='line-number'><a name='L394' href='#L394'><pre>394</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let t2 = thread::spawn(|| {</pre></td></tr><tr><td class='line-number'><a name='L395' href='#L395'><pre>395</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut called = false;</pre></td></tr><tr><td class='line-number'><a name='L396' href='#L396'><pre>396</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> O.init(|| {</pre></td></tr><tr><td class='line-number'><a name='L397' href='#L397'><pre>397</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> called = true;</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(!called);</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> });</pre></td></tr><tr><td class='line-number'><a name='L401' href='#L401'><pre>401</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L402' href='#L402'><pre>402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> tx2.send(()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L403' href='#L403'><pre>403</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L404' href='#L404'><pre>404</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(t1.join().is_ok());</pre></td></tr><tr><td class='line-number'><a name='L405' href='#L405'><pre>405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(t2.join().is_ok());</pre></td></tr><tr><td class='line-number'><a name='L406' href='#L406'><pre>406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L407' href='#L407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L408' href='#L408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L409' href='#L409'><pre>409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[cfg(target_pointer_width = "64")]</pre></td></tr><tr><td class='line-number'><a name='L410' href='#L410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn test_size() {</pre></td></tr><tr><td class='line-number'><a name='L411' href='#L411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use std::mem::size_of;</pre></td></tr><tr><td class='line-number'><a name='L412' href='#L412'><pre>412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L413' href='#L413'><pre>413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(size_of::<OnceCell<u32>>(), 4 * size_of::<u32>());</pre></td></tr><tr><td class='line-number'><a name='L414' href='#L414'><pre>414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L415' href='#L415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.18.0/src/lib.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L426'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # Overview</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `once_cell` provides two new cell-like types, [`unsync::OnceCell`] and</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`sync::OnceCell`]. A `OnceCell` might store arbitrary non-`Copy` types, can</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! be assigned to at most once and provides direct access to the stored</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! contents. The core API looks *roughly* like this (and there's much more</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! inside, read on!):</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```rust,ignore</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! impl<T> OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! const fn new() -> OnceCell<T> { ... }</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn set(&self, value: T) -> Result<(), T> { ... }</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn get(&self) -> Option<&T> { ... }</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Note that, like with [`RefCell`] and [`Mutex`], the `set` method requires</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! only a shared reference. Because of the single assignment restriction `get`</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! can return a `&T` instead of `Ref<T>` or `MutexGuard<T>`.</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! The `sync` flavor is thread-safe (that is, implements the [`Sync`] trait),</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! while the `unsync` one is not.</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`unsync::OnceCell`]: unsync/struct.OnceCell.html</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`sync::OnceCell`]: sync/struct.OnceCell.html</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`RefCell`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`Mutex`]: https://doc.rust-lang.org/std/sync/struct.Mutex.html</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # Recipes</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `OnceCell` might be useful for a variety of patterns.</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ## Safe Initialization of Global Data</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```rust</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use std::{env, io};</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! #[derive(Debug)]</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! pub struct Logger {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! // ...</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! static INSTANCE: OnceCell<Logger> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! impl Logger {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! pub fn global() -> &'static Logger {</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! INSTANCE.get().expect("logger is not initialized")</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn from_cli(args: env::Args) -> Result<Logger, std::io::Error> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! // ...</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # Ok(Logger {})</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn main() {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let logger = Logger::from_cli(env::args()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! INSTANCE.set(logger).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! // use `Logger::global()` from now on</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ## Lazy Initialized Global Data</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! This is essentially the `lazy_static!` macro, but without a macro.</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```rust</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use std::{sync::Mutex, collections::HashMap};</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn global_data() -> &'static Mutex<HashMap<i32, String>> {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! static INSTANCE: OnceCell<Mutex<HashMap<i32, String>>> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! INSTANCE.get_or_init(|| {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let mut m = HashMap::new();</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! m.insert(13, "Spica".to_string());</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! m.insert(74, "Hoyten".to_string());</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Mutex::new(m)</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! })</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! There are also the [`sync::Lazy`] and [`unsync::Lazy`] convenience types to</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! streamline this pattern:</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```rust</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use std::{sync::Mutex, collections::HashMap};</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use once_cell::sync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! static GLOBAL_DATA: Lazy<Mutex<HashMap<i32, String>>> = Lazy::new(|| {</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let mut m = HashMap::new();</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! m.insert(13, "Spica".to_string());</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! m.insert(74, "Hoyten".to_string());</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Mutex::new(m)</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! });</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn main() {</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! println!("{:?}", GLOBAL_DATA.lock().unwrap());</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Note that the variable that holds `Lazy` is declared as `static`, *not*</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `const`. This is important: using `const` instead compiles, but works wrong.</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`sync::Lazy`]: sync/struct.Lazy.html</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`unsync::Lazy`]: unsync/struct.Lazy.html</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ## General purpose lazy evaluation</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Unlike `lazy_static!`, `Lazy` works with local variables.</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```rust</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use once_cell::unsync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn main() {</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let ctx = vec![1, 2, 3];</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let thunk = Lazy::new(|| {</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ctx.iter().sum::<i32>()</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! });</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! assert_eq!(*thunk, 6);</pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! If you need a lazy field in a struct, you probably should use `OnceCell`</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! directly, because that will allow you to access `self` during</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! initialization.</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```rust</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use std::{fs, path::PathBuf};</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! struct Ctx {</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! config_path: PathBuf,</pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! config: OnceCell<String>,</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! impl Ctx {</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! pub fn get_config(&self) -> Result<&str, std::io::Error> {</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let cfg = self.config.get_or_try_init(|| {</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fs::read_to_string(&self.config_path)</pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! })?;</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Ok(cfg.as_str())</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ## Lazily Compiled Regex</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! This is a `regex!` macro which takes a string literal and returns an</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! *expression* that evaluates to a `&'static Regex`:</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! macro_rules! regex {</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ($re:literal $(,)?) => {{</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! static RE: once_cell::sync::OnceCell<regex::Regex> = once_cell::sync::OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! RE.get_or_init(|| regex::Regex::new($re).unwrap())</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }};</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! This macro can be useful to avoid the "compile regex on every loop</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! iteration" problem.</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ## Runtime `include_bytes!`</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! The `include_bytes` macro is useful to include test resources, but it slows</pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! down test compilation a lot. An alternative is to load the resources at</pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! runtime:</pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use std::path::Path;</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! pub struct TestResource {</pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! path: &'static str,</pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! cell: OnceCell<Vec<u8>>,</pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! impl TestResource {</pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! pub const fn new(path: &'static str) -> TestResource {</pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! TestResource { path, cell: OnceCell::new() }</pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! pub fn bytes(&self) -> &[u8] {</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! self.cell.get_or_init(|| {</pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();</pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let path = Path::new(dir.as_str()).join(self.path);</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! std::fs::read(&path).unwrap_or_else(|_err| {</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! panic!("failed to load test resource: {}", path.display())</pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! })</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }).as_slice()</pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! static TEST_IMAGE: TestResource = TestResource::new("test_data/lena.png");</pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! #[test]</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn test_sobel_filter() {</pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let rgb: &[u8] = TEST_IMAGE.bytes();</pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! // ...</pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # drop(rgb);</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ## `lateinit`</pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `LateInit` type for delayed initialization. It is reminiscent of Kotlin's</pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `lateinit` keyword and allows construction of cyclic data structures:</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! pub struct LateInit<T> { cell: OnceCell<T> }</pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! impl<T> LateInit<T> {</pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! pub fn init(&self, value: T) {</pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! assert!(self.cell.set(value).is_ok())</pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! impl<T> Default for LateInit<T> {</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn default() -> Self { LateInit { cell: OnceCell::default() } }</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! impl<T> std::ops::Deref for LateInit<T> {</pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! type Target = T;</pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn deref(&self) -> &T {</pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! self.cell.get().unwrap()</pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! #[derive(Default)]</pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! struct A<'a> {</pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! b: LateInit<&'a B<'a>>,</pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! #[derive(Default)]</pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! struct B<'a> {</pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! a: LateInit<&'a A<'a>></pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! fn build_cycle() {</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let a = A::default();</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let b = B::default();</pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! a.b.init(&b);</pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! b.a.init(&a);</pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! let _a = &a.b.a.b.a;</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! }</pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! ```</pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # Comparison with std</pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |`!Sync` types | Access Mode | Drawbacks |</pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |----------------------|------------------------|-----------------------------------------------|</pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |`Cell<T>` | `T` | requires `T: Copy` for `get` |</pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |`RefCell<T>` | `RefMut<T>` / `Ref<T>` | may panic at runtime |</pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |`unsync::OnceCell<T>` | `&T` | assignable only once |</pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |`Sync` types | Access Mode | Drawbacks |</pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |----------------------|------------------------|-----------------------------------------------|</pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |`AtomicT` | `T` | works only with certain `Copy` types |</pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |`Mutex<T>` | `MutexGuard<T>` | may deadlock at runtime, may block the thread |</pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! |`sync::OnceCell<T>` | `&T` | assignable only once, may block the thread |</pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Technically, calling `get_or_init` will also cause a panic or a deadlock if</pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! it recursively calls itself. However, because the assignment can happen only</pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! once, such cases should be more rare than equivalents with `RefCell` and</pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `Mutex`.</pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # Minimum Supported `rustc` Version</pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! This crate's minimum supported `rustc` version is `1.56.0`.</pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! If only the `std` feature is enabled, MSRV will be updated conservatively,</pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! supporting at least latest 8 versions of the compiler. When using other</pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! features, like `parking_lot`, MSRV might be updated more frequently, up to</pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! the latest stable. In both cases, increasing MSRV is *not* considered a</pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! semver-breaking change.</pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # Implementation details</pre></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! The implementation is based on the</pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`lazy_static`](https://github.com/rust-lang-nursery/lazy-static.rs/) and</pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`lazy_cell`](https://github.com/indiv0/lazycell/) crates and</pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`std::sync::Once`]. In some sense, `once_cell` just streamlines and unifies</pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! those APIs.</pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! To implement a sync flavor of `OnceCell`, this crates uses either a custom</pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! re-implementation of `std::sync::Once` or `parking_lot::Mutex`. This is</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! controlled by the `parking_lot` feature (disabled by default). Performance</pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! is the same for both cases, but the `parking_lot` based `OnceCell<T>` is</pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! smaller by up to 16 bytes.</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! This crate uses `unsafe`.</pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`std::sync::Once`]: https://doc.rust-lang.org/std/sync/struct.Once.html</pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # F.A.Q.</pre></td></tr><tr><td class='line-number'><a name='L305' href='#L305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L306' href='#L306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! **Should I use the sync or unsync flavor?**</pre></td></tr><tr><td class='line-number'><a name='L307' href='#L307'><pre>307</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L308' href='#L308'><pre>308</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Because Rust compiler checks thread safety for you, it's impossible to</pre></td></tr><tr><td class='line-number'><a name='L309' href='#L309'><pre>309</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! accidentally use `unsync` where `sync` is required. So, use `unsync` in</pre></td></tr><tr><td class='line-number'><a name='L310' href='#L310'><pre>310</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! single-threaded code and `sync` in multi-threaded. It's easy to switch</pre></td></tr><tr><td class='line-number'><a name='L311' href='#L311'><pre>311</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! between the two if code becomes multi-threaded later.</pre></td></tr><tr><td class='line-number'><a name='L312' href='#L312'><pre>312</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L313' href='#L313'><pre>313</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! At the moment, `unsync` has an additional benefit that reentrant</pre></td></tr><tr><td class='line-number'><a name='L314' href='#L314'><pre>314</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! initialization causes a panic, which might be easier to debug than a</pre></td></tr><tr><td class='line-number'><a name='L315' href='#L315'><pre>315</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! deadlock.</pre></td></tr><tr><td class='line-number'><a name='L316' href='#L316'><pre>316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L317' href='#L317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! **Does this crate support async?**</pre></td></tr><tr><td class='line-number'><a name='L318' href='#L318'><pre>318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L319' href='#L319'><pre>319</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! No, but you can use</pre></td></tr><tr><td class='line-number'><a name='L320' href='#L320'><pre>320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [`async_once_cell`](https://crates.io/crates/async_once_cell) instead.</pre></td></tr><tr><td class='line-number'><a name='L321' href='#L321'><pre>321</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L322' href='#L322'><pre>322</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! **Does this crate support `no_std`?**</pre></td></tr><tr><td class='line-number'><a name='L323' href='#L323'><pre>323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L324' href='#L324'><pre>324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Yes, but with caveats. `OnceCell` is a synchronization primitive which</pre></td></tr><tr><td class='line-number'><a name='L325' href='#L325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! _semantically_ relies on blocking. `OnceCell` guarantees that at most one</pre></td></tr><tr><td class='line-number'><a name='L326' href='#L326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `f` will be called to compute the value. If two threads of execution call</pre></td></tr><tr><td class='line-number'><a name='L327' href='#L327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `get_or_init` concurrently, one of them has to wait.</pre></td></tr><tr><td class='line-number'><a name='L328' href='#L328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L329' href='#L329'><pre>329</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Waiting fundamentally requires OS support. Execution environment needs to</pre></td></tr><tr><td class='line-number'><a name='L330' href='#L330'><pre>330</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! understand who waits on whom to prevent deadlocks due to priority inversion.</pre></td></tr><tr><td class='line-number'><a name='L331' href='#L331'><pre>331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! You _could_ make code to compile by blindly using pure spinlocks, but the</pre></td></tr><tr><td class='line-number'><a name='L332' href='#L332'><pre>332</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! runtime behavior would be subtly wrong.</pre></td></tr><tr><td class='line-number'><a name='L333' href='#L333'><pre>333</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L334' href='#L334'><pre>334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Given these constraints, `once_cell` provides the following options:</pre></td></tr><tr><td class='line-number'><a name='L335' href='#L335'><pre>335</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L336' href='#L336'><pre>336</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! - The `race` module provides similar, but distinct synchronization primitive</pre></td></tr><tr><td class='line-number'><a name='L337' href='#L337'><pre>337</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! which is compatible with `no_std`. With `race`, the `f` function can be</pre></td></tr><tr><td class='line-number'><a name='L338' href='#L338'><pre>338</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! called multiple times by different threads, but only one thread will win</pre></td></tr><tr><td class='line-number'><a name='L339' href='#L339'><pre>339</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! to install the value.</pre></td></tr><tr><td class='line-number'><a name='L340' href='#L340'><pre>340</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! - `critical-section` feature (with a `-`, not `_`) uses `critical_section`</pre></td></tr><tr><td class='line-number'><a name='L341' href='#L341'><pre>341</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! to implement blocking.</pre></td></tr><tr><td class='line-number'><a name='L342' href='#L342'><pre>342</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L343' href='#L343'><pre>343</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! **Can I bring my own mutex?**</pre></td></tr><tr><td class='line-number'><a name='L344' href='#L344'><pre>344</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L345' href='#L345'><pre>345</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! There is [generic_once_cell](https://crates.io/crates/generic_once_cell) to</pre></td></tr><tr><td class='line-number'><a name='L346' href='#L346'><pre>346</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! allow just that.</pre></td></tr><tr><td class='line-number'><a name='L347' href='#L347'><pre>347</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L348' href='#L348'><pre>348</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! **Should I use `std::cell::OnceCell`, `once_cell`, or `lazy_static`?**</pre></td></tr><tr><td class='line-number'><a name='L349' href='#L349'><pre>349</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L350' href='#L350'><pre>350</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! If you can use `std` version (your MSRV is at least 1.70, and you don't need</pre></td></tr><tr><td class='line-number'><a name='L351' href='#L351'><pre>351</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! extra features `once_cell` provides), use `std`. Otherwise, use `once_cell`.</pre></td></tr><tr><td class='line-number'><a name='L352' href='#L352'><pre>352</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Don't use `lazy_static`.</pre></td></tr><tr><td class='line-number'><a name='L353' href='#L353'><pre>353</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L354' href='#L354'><pre>354</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # Related crates</pre></td></tr><tr><td class='line-number'><a name='L355' href='#L355'><pre>355</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L356' href='#L356'><pre>356</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! * Most of this crate's functionality is available in `std` starting with</pre></td></tr><tr><td class='line-number'><a name='L357' href='#L357'><pre>357</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Rust 1.70. See `std::cell::OnceCell` and `std::sync::OnceLock`.</pre></td></tr><tr><td class='line-number'><a name='L358' href='#L358'><pre>358</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! * [double-checked-cell](https://github.com/niklasf/double-checked-cell)</pre></td></tr><tr><td class='line-number'><a name='L359' href='#L359'><pre>359</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! * [lazy-init](https://crates.io/crates/lazy-init)</pre></td></tr><tr><td class='line-number'><a name='L360' href='#L360'><pre>360</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! * [lazycell](https://crates.io/crates/lazycell)</pre></td></tr><tr><td class='line-number'><a name='L361' href='#L361'><pre>361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! * [mitochondria](https://crates.io/crates/mitochondria)</pre></td></tr><tr><td class='line-number'><a name='L362' href='#L362'><pre>362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! * [lazy_static](https://crates.io/crates/lazy_static)</pre></td></tr><tr><td class='line-number'><a name='L363' href='#L363'><pre>363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! * [async_once_cell](https://crates.io/crates/async_once_cell)</pre></td></tr><tr><td class='line-number'><a name='L364' href='#L364'><pre>364</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! * [generic_once_cell](https://crates.io/crates/generic_once_cell) (bring</pre></td></tr><tr><td class='line-number'><a name='L365' href='#L365'><pre>365</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! your own mutex)</pre></td></tr><tr><td class='line-number'><a name='L366' href='#L366'><pre>366</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L367' href='#L367'><pre>367</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#![cfg_attr(not(feature = "std"), no_std)]</pre></td></tr><tr><td class='line-number'><a name='L368' href='#L368'><pre>368</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L369' href='#L369'><pre>369</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature = "alloc")]</pre></td></tr><tr><td class='line-number'><a name='L370' href='#L370'><pre>370</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>extern crate alloc;</pre></td></tr><tr><td class='line-number'><a name='L371' href='#L371'><pre>371</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L372' href='#L372'><pre>372</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(all(feature = "critical-section", not(feature = "std")))]</pre></td></tr><tr><td class='line-number'><a name='L373' href='#L373'><pre>373</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[path = "imp_cs.rs"]</pre></td></tr><tr><td class='line-number'><a name='L374' href='#L374'><pre>374</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod imp;</pre></td></tr><tr><td class='line-number'><a name='L375' href='#L375'><pre>375</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L376' href='#L376'><pre>376</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(all(feature = "std", feature = "parking_lot"))]</pre></td></tr><tr><td class='line-number'><a name='L377' href='#L377'><pre>377</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[path = "imp_pl.rs"]</pre></td></tr><tr><td class='line-number'><a name='L378' href='#L378'><pre>378</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod imp;</pre></td></tr><tr><td class='line-number'><a name='L379' href='#L379'><pre>379</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L380' href='#L380'><pre>380</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(all(feature = "std", not(feature = "parking_lot")))]</pre></td></tr><tr><td class='line-number'><a name='L381' href='#L381'><pre>381</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[path = "imp_std.rs"]</pre></td></tr><tr><td class='line-number'><a name='L382' href='#L382'><pre>382</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod imp;</pre></td></tr><tr><td class='line-number'><a name='L383' href='#L383'><pre>383</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L384' href='#L384'><pre>384</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Single-threaded version of `OnceCell`.</pre></td></tr><tr><td class='line-number'><a name='L385' href='#L385'><pre>385</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod unsync {</pre></td></tr><tr><td class='line-number'><a name='L386' href='#L386'><pre>386</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use core::{</pre></td></tr><tr><td class='line-number'><a name='L387' href='#L387'><pre>387</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cell::{Cell, UnsafeCell},</pre></td></tr><tr><td class='line-number'><a name='L388' href='#L388'><pre>388</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fmt, mem,</pre></td></tr><tr><td class='line-number'><a name='L389' href='#L389'><pre>389</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ops::{Deref, DerefMut},</pre></td></tr><tr><td class='line-number'><a name='L390' href='#L390'><pre>390</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> panic::{RefUnwindSafe, UnwindSafe},</pre></td></tr><tr><td class='line-number'><a name='L391' href='#L391'><pre>391</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L392' href='#L392'><pre>392</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L393' href='#L393'><pre>393</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A cell which can be written to only once. It is not thread safe.</pre></td></tr><tr><td class='line-number'><a name='L394' href='#L394'><pre>394</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L395' href='#L395'><pre>395</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Unlike [`std::cell::RefCell`], a `OnceCell` provides simple `&`</pre></td></tr><tr><td class='line-number'><a name='L396' href='#L396'><pre>396</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// references to the contents.</pre></td></tr><tr><td class='line-number'><a name='L397' href='#L397'><pre>397</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// [`std::cell::RefCell`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L401' href='#L401'><pre>401</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L402' href='#L402'><pre>402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L403' href='#L403'><pre>403</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L404' href='#L404'><pre>404</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L405' href='#L405'><pre>405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_none());</pre></td></tr><tr><td class='line-number'><a name='L406' href='#L406'><pre>406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L407' href='#L407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value: &String = cell.get_or_init(|| {</pre></td></tr><tr><td class='line-number'><a name='L408' href='#L408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// "Hello, World!".to_string()</pre></td></tr><tr><td class='line-number'><a name='L409' href='#L409'><pre>409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// });</pre></td></tr><tr><td class='line-number'><a name='L410' href='#L410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value, "Hello, World!");</pre></td></tr><tr><td class='line-number'><a name='L411' href='#L411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_some());</pre></td></tr><tr><td class='line-number'><a name='L412' href='#L412'><pre>412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L413' href='#L413'><pre>413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub struct OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L414' href='#L414'><pre>414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Invariant: written to at most once.</pre></td></tr><tr><td class='line-number'><a name='L415' href='#L415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> inner: UnsafeCell<Option<T>>,</pre></td></tr><tr><td class='line-number'><a name='L416' href='#L416'><pre>416</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L417' href='#L417'><pre>417</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L418' href='#L418'><pre>418</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Similarly to a `Sync` bound on `sync::OnceCell`, we can use</pre></td></tr><tr><td class='line-number'><a name='L419' href='#L419'><pre>419</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `&unsync::OnceCell` to sneak a `T` through `catch_unwind`,</pre></td></tr><tr><td class='line-number'><a name='L420' href='#L420'><pre>420</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // by initializing the cell in closure and extracting the value in the</pre></td></tr><tr><td class='line-number'><a name='L421' href='#L421'><pre>421</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `Drop`.</pre></td></tr><tr><td class='line-number'><a name='L422' href='#L422'><pre>422</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: RefUnwindSafe + UnwindSafe> RefUnwindSafe for OnceCell<T> {}</pre></td></tr><tr><td class='line-number'><a name='L423' href='#L423'><pre>423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: UnwindSafe> UnwindSafe for OnceCell<T> {}</pre></td></tr><tr><td class='line-number'><a name='L424' href='#L424'><pre>424</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> Default for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn default() -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Self::new()</span></pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: fmt::Debug> fmt::Debug for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get()</span> {</pre></td></tr><tr><td class='line-number'><a name='L434' href='#L434'><pre>434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>v) => f.debug_tuple("OnceCell").field(v).finish()</span>,</pre></td></tr><tr><td class='line-number'><a name='L435' href='#L435'><pre>435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>f.write_str("OnceCell(Uninit)")</span>,</pre></td></tr><tr><td class='line-number'><a name='L436' href='#L436'><pre>436</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L437' href='#L437'><pre>437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L438' href='#L438'><pre>438</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L439' href='#L439'><pre>439</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L440' href='#L440'><pre>440</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: Clone> Clone for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L441' href='#L441'><pre>441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn clone(&self) -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L442' href='#L442'><pre>442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get()</span> {</pre></td></tr><tr><td class='line-number'><a name='L443' href='#L443'><pre>443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>value) => OnceCell::with_value(value.clone())</span>,</pre></td></tr><tr><td class='line-number'><a name='L444' href='#L444'><pre>444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>OnceCell::new()</span>,</pre></td></tr><tr><td class='line-number'><a name='L445' href='#L445'><pre>445</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L446' href='#L446'><pre>446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L447' href='#L447'><pre>447</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L448' href='#L448'><pre>448</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn clone_from(&mut self, source: &Self) {</pre></td></tr><tr><td class='line-number'><a name='L449' href='#L449'><pre>449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> match (<span class='red'>self.get_mut(), source.get()</span>) {</pre></td></tr><tr><td class='line-number'><a name='L450' href='#L450'><pre>450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (Some(<span class='red'>this), Some(source)) => this.clone_from(source)</span>,</pre></td></tr><tr><td class='line-number'><a name='L451' href='#L451'><pre>451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> _ => <span class='red'>*self = source.clone()</span>,</pre></td></tr><tr><td class='line-number'><a name='L452' href='#L452'><pre>452</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L453' href='#L453'><pre>453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L454' href='#L454'><pre>454</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L455' href='#L455'><pre>455</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L456' href='#L456'><pre>456</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: PartialEq> PartialEq for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L457' href='#L457'><pre>457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn eq(&self, other: &Self) -> bool {</span></pre></td></tr><tr><td class='line-number'><a name='L458' href='#L458'><pre>458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.get() == other.get()</span></pre></td></tr><tr><td class='line-number'><a name='L459' href='#L459'><pre>459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L460' href='#L460'><pre>460</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L461' href='#L461'><pre>461</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L462' href='#L462'><pre>462</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: Eq> Eq for OnceCell<T> {}</pre></td></tr><tr><td class='line-number'><a name='L463' href='#L463'><pre>463</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L464' href='#L464'><pre>464</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> From<T> for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L465' href='#L465'><pre>465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(value: T) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L466' href='#L466'><pre>466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceCell::with_value(value)</span></pre></td></tr><tr><td class='line-number'><a name='L467' href='#L467'><pre>467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L468' href='#L468'><pre>468</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L469' href='#L469'><pre>469</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L470' href='#L470'><pre>470</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L471' href='#L471'><pre>471</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new empty cell.</pre></td></tr><tr><td class='line-number'><a name='L472' href='#L472'><pre>472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new() -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L473' href='#L473'><pre>473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceCell { inner: UnsafeCell::new(None) }</span></pre></td></tr><tr><td class='line-number'><a name='L474' href='#L474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L475' href='#L475'><pre>475</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L476' href='#L476'><pre>476</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new initialized cell.</pre></td></tr><tr><td class='line-number'><a name='L477' href='#L477'><pre>477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn with_value(value: T) -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L478' href='#L478'><pre>478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceCell { inner: UnsafeCell::new(Some(value)) }</span></pre></td></tr><tr><td class='line-number'><a name='L479' href='#L479'><pre>479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L480' href='#L480'><pre>480</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L481' href='#L481'><pre>481</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets a reference to the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L482' href='#L482'><pre>482</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L483' href='#L483'><pre>483</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `None` if the cell is empty.</pre></td></tr><tr><td class='line-number'><a name='L484' href='#L484'><pre>484</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L485' href='#L485'><pre>485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get(&self) -> Option<&T> {</span></pre></td></tr><tr><td class='line-number'><a name='L486' href='#L486'><pre>486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Safe due to `inner`'s invariant of being written to at most once.</span></pre></td></tr><tr><td class='line-number'><a name='L487' href='#L487'><pre>487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Had multiple writes to `inner` been allowed, a reference to the</span></pre></td></tr><tr><td class='line-number'><a name='L488' href='#L488'><pre>488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // value we return now would become dangling by a write of a</span></pre></td></tr><tr><td class='line-number'><a name='L489' href='#L489'><pre>489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // different value later.</span></pre></td></tr><tr><td class='line-number'><a name='L490' href='#L490'><pre>490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsafe { &*self.inner.get() }.as_ref()</span></pre></td></tr><tr><td class='line-number'><a name='L491' href='#L491'><pre>491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L492' href='#L492'><pre>492</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L493' href='#L493'><pre>493</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets a mutable reference to the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L494' href='#L494'><pre>494</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L495' href='#L495'><pre>495</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `None` if the cell is empty.</pre></td></tr><tr><td class='line-number'><a name='L496' href='#L496'><pre>496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L497' href='#L497'><pre>497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method is allowed to violate the invariant of writing to a `OnceCell`</pre></td></tr><tr><td class='line-number'><a name='L498' href='#L498'><pre>498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// at most once because it requires `&mut` access to `self`. As with all</pre></td></tr><tr><td class='line-number'><a name='L499' href='#L499'><pre>499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// interior mutability, `&mut` access permits arbitrary modification:</pre></td></tr><tr><td class='line-number'><a name='L500' href='#L500'><pre>500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L501' href='#L501'><pre>501</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L502' href='#L502'><pre>502</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L503' href='#L503'><pre>503</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L504' href='#L504'><pre>504</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell: OnceCell<u32> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L505' href='#L505'><pre>505</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell.set(92).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L506' href='#L506'><pre>506</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// *cell.get_mut().unwrap() = 93;</pre></td></tr><tr><td class='line-number'><a name='L507' href='#L507'><pre>507</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.get(), Some(&93));</pre></td></tr><tr><td class='line-number'><a name='L508' href='#L508'><pre>508</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L509' href='#L509'><pre>509</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L510' href='#L510'><pre>510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_mut(&mut self) -> Option<&mut T> {</span></pre></td></tr><tr><td class='line-number'><a name='L511' href='#L511'><pre>511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Safe because we have unique access</span></pre></td></tr><tr><td class='line-number'><a name='L512' href='#L512'><pre>512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsafe { &mut *self.inner.get() }.as_mut()</span></pre></td></tr><tr><td class='line-number'><a name='L513' href='#L513'><pre>513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L514' href='#L514'><pre>514</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L515' href='#L515'><pre>515</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Sets the contents of this cell to `value`.</pre></td></tr><tr><td class='line-number'><a name='L516' href='#L516'><pre>516</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L517' href='#L517'><pre>517</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `Ok(())` if the cell was empty and `Err(value)` if it was</pre></td></tr><tr><td class='line-number'><a name='L518' href='#L518'><pre>518</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// full.</pre></td></tr><tr><td class='line-number'><a name='L519' href='#L519'><pre>519</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L520' href='#L520'><pre>520</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L521' href='#L521'><pre>521</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L522' href='#L522'><pre>522</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L523' href='#L523'><pre>523</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L524' href='#L524'><pre>524</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L525' href='#L525'><pre>525</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_none());</pre></td></tr><tr><td class='line-number'><a name='L526' href='#L526'><pre>526</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L527' href='#L527'><pre>527</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.set(92), Ok(()));</pre></td></tr><tr><td class='line-number'><a name='L528' href='#L528'><pre>528</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.set(62), Err(62));</pre></td></tr><tr><td class='line-number'><a name='L529' href='#L529'><pre>529</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L530' href='#L530'><pre>530</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_some());</pre></td></tr><tr><td class='line-number'><a name='L531' href='#L531'><pre>531</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L532' href='#L532'><pre>532</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn set(&self, value: T) -> Result<(), T> {</span></pre></td></tr><tr><td class='line-number'><a name='L533' href='#L533'><pre>533</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.try_insert(value)</span> {</pre></td></tr><tr><td class='line-number'><a name='L534' href='#L534'><pre>534</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(_) => <span class='red'>Ok(())</span>,</pre></td></tr><tr><td class='line-number'><a name='L535' href='#L535'><pre>535</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Err((_, <span class='red'>value)) => Err(value)</span>,</pre></td></tr><tr><td class='line-number'><a name='L536' href='#L536'><pre>536</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L537' href='#L537'><pre>537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L538' href='#L538'><pre>538</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L539' href='#L539'><pre>539</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Like [`set`](Self::set), but also returns a reference to the final cell value.</pre></td></tr><tr><td class='line-number'><a name='L540' href='#L540'><pre>540</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L541' href='#L541'><pre>541</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L542' href='#L542'><pre>542</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L543' href='#L543'><pre>543</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L544' href='#L544'><pre>544</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L545' href='#L545'><pre>545</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L546' href='#L546'><pre>546</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_none());</pre></td></tr><tr><td class='line-number'><a name='L547' href='#L547'><pre>547</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L548' href='#L548'><pre>548</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.try_insert(92), Ok(&92));</pre></td></tr><tr><td class='line-number'><a name='L549' href='#L549'><pre>549</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.try_insert(62), Err((&92, 62)));</pre></td></tr><tr><td class='line-number'><a name='L550' href='#L550'><pre>550</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L551' href='#L551'><pre>551</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_some());</pre></td></tr><tr><td class='line-number'><a name='L552' href='#L552'><pre>552</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L553' href='#L553'><pre>553</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn try_insert(&self, value: T) -> Result<&T, (&T, T)> {</pre></td></tr><tr><td class='line-number'><a name='L554' href='#L554'><pre>554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Some(<span class='red'>old</span>) = <span class='red'>self.get()</span> {</pre></td></tr><tr><td class='line-number'><a name='L555' href='#L555'><pre>555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err((old, value))</span>;</pre></td></tr><tr><td class='line-number'><a name='L556' href='#L556'><pre>556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L557' href='#L557'><pre>557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L558' href='#L558'><pre>558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let slot = unsafe { &mut *self.inner.get() };</span></pre></td></tr><tr><td class='line-number'><a name='L559' href='#L559'><pre>559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This is the only place where we set the slot, no races</span></pre></td></tr><tr><td class='line-number'><a name='L560' href='#L560'><pre>560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // due to reentrancy/concurrency are possible, and we've</span></pre></td></tr><tr><td class='line-number'><a name='L561' href='#L561'><pre>561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // checked that slot is currently `None`, so this write</span></pre></td></tr><tr><td class='line-number'><a name='L562' href='#L562'><pre>562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // maintains the `inner`'s invariant.</span></pre></td></tr><tr><td class='line-number'><a name='L563' href='#L563'><pre>563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *slot = Some(value);</span></pre></td></tr><tr><td class='line-number'><a name='L564' href='#L564'><pre>564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(unsafe { slot.as_ref().unwrap_unchecked() })</span></pre></td></tr><tr><td class='line-number'><a name='L565' href='#L565'><pre>565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L566' href='#L566'><pre>566</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L567' href='#L567'><pre>567</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f`</pre></td></tr><tr><td class='line-number'><a name='L568' href='#L568'><pre>568</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// if the cell was empty.</pre></td></tr><tr><td class='line-number'><a name='L569' href='#L569'><pre>569</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L570' href='#L570'><pre>570</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Panics</pre></td></tr><tr><td class='line-number'><a name='L571' href='#L571'><pre>571</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L572' href='#L572'><pre>572</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If `f` panics, the panic is propagated to the caller, and the cell</pre></td></tr><tr><td class='line-number'><a name='L573' href='#L573'><pre>573</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// remains uninitialized.</pre></td></tr><tr><td class='line-number'><a name='L574' href='#L574'><pre>574</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L575' href='#L575'><pre>575</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// It is an error to reentrantly initialize the cell from `f`. Doing</pre></td></tr><tr><td class='line-number'><a name='L576' href='#L576'><pre>576</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// so results in a panic.</pre></td></tr><tr><td class='line-number'><a name='L577' href='#L577'><pre>577</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L578' href='#L578'><pre>578</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L579' href='#L579'><pre>579</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L580' href='#L580'><pre>580</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L581' href='#L581'><pre>581</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L582' href='#L582'><pre>582</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L583' href='#L583'><pre>583</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value = cell.get_or_init(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L584' href='#L584'><pre>584</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value, &92);</pre></td></tr><tr><td class='line-number'><a name='L585' href='#L585'><pre>585</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value = cell.get_or_init(|| unreachable!());</pre></td></tr><tr><td class='line-number'><a name='L586' href='#L586'><pre>586</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value, &92);</pre></td></tr><tr><td class='line-number'><a name='L587' href='#L587'><pre>587</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L588' href='#L588'><pre>588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_init<F>(&self, f: F) -> &T</span></pre></td></tr><tr><td class='line-number'><a name='L589' href='#L589'><pre>589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L590' href='#L590'><pre>590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> T,</span></pre></td></tr><tr><td class='line-number'><a name='L591' href='#L591'><pre>591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L592' href='#L592'><pre>592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> enum Void {}</span></pre></td></tr><tr><td class='line-number'><a name='L593' href='#L593'><pre>593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get_or_try_init(</span>|| <span class='red'>Ok::<T, Void>(f())</span><span class='red'>)</span> {</pre></td></tr><tr><td class='line-number'><a name='L594' href='#L594'><pre>594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(<span class='red'>val) => val,</span></pre></td></tr><tr><td class='line-number'><a name='L595' href='#L595'><pre>595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Err(void) => match void {},</span></pre></td></tr><tr><td class='line-number'><a name='L596' href='#L596'><pre>596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L597' href='#L597'><pre>597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L598' href='#L598'><pre>598</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L599' href='#L599'><pre>599</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if</pre></td></tr><tr><td class='line-number'><a name='L600' href='#L600'><pre>600</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the cell was empty. If the cell was empty and `f` failed, an</pre></td></tr><tr><td class='line-number'><a name='L601' href='#L601'><pre>601</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// error is returned.</pre></td></tr><tr><td class='line-number'><a name='L602' href='#L602'><pre>602</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L603' href='#L603'><pre>603</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Panics</pre></td></tr><tr><td class='line-number'><a name='L604' href='#L604'><pre>604</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L605' href='#L605'><pre>605</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If `f` panics, the panic is propagated to the caller, and the cell</pre></td></tr><tr><td class='line-number'><a name='L606' href='#L606'><pre>606</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// remains uninitialized.</pre></td></tr><tr><td class='line-number'><a name='L607' href='#L607'><pre>607</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L608' href='#L608'><pre>608</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// It is an error to reentrantly initialize the cell from `f`. Doing</pre></td></tr><tr><td class='line-number'><a name='L609' href='#L609'><pre>609</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// so results in a panic.</pre></td></tr><tr><td class='line-number'><a name='L610' href='#L610'><pre>610</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L611' href='#L611'><pre>611</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L612' href='#L612'><pre>612</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L613' href='#L613'><pre>613</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L614' href='#L614'><pre>614</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L615' href='#L615'><pre>615</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L616' href='#L616'><pre>616</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.get_or_try_init(|| Err(())), Err(()));</pre></td></tr><tr><td class='line-number'><a name='L617' href='#L617'><pre>617</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_none());</pre></td></tr><tr><td class='line-number'><a name='L618' href='#L618'><pre>618</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value = cell.get_or_try_init(|| -> Result<i32, ()> {</pre></td></tr><tr><td class='line-number'><a name='L619' href='#L619'><pre>619</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Ok(92)</pre></td></tr><tr><td class='line-number'><a name='L620' href='#L620'><pre>620</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// });</pre></td></tr><tr><td class='line-number'><a name='L621' href='#L621'><pre>621</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value, Ok(&92));</pre></td></tr><tr><td class='line-number'><a name='L622' href='#L622'><pre>622</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.get(), Some(&92))</pre></td></tr><tr><td class='line-number'><a name='L623' href='#L623'><pre>623</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L624' href='#L624'><pre>624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E></span></pre></td></tr><tr><td class='line-number'><a name='L625' href='#L625'><pre>625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L626' href='#L626'><pre>626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> Result<T, E>,</span></pre></td></tr><tr><td class='line-number'><a name='L627' href='#L627'><pre>627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span>{</pre></td></tr><tr><td class='line-number'><a name='L628' href='#L628'><pre>628</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Some(<span class='red'>val</span>) = <span class='red'>self.get()</span> {</pre></td></tr><tr><td class='line-number'><a name='L629' href='#L629'><pre>629</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Ok(val)</span>;</pre></td></tr><tr><td class='line-number'><a name='L630' href='#L630'><pre>630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L631' href='#L631'><pre>631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>val</span> = <span class='red'>f()</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L632' href='#L632'><pre>632</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Note that *some* forms of reentrant initialization might lead to</pre></td></tr><tr><td class='line-number'><a name='L633' href='#L633'><pre>633</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // UB (see `reentrant_init` test). I believe that just removing this</pre></td></tr><tr><td class='line-number'><a name='L634' href='#L634'><pre>634</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `assert`, while keeping `set/get` would be sound, but it seems</pre></td></tr><tr><td class='line-number'><a name='L635' href='#L635'><pre>635</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // better to panic, rather than to silently use an old value.</pre></td></tr><tr><td class='line-number'><a name='L636' href='#L636'><pre>636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>assert!(self.set(val).is_ok()</span>, <span class='red'>"reentrant init"</span>);</pre></td></tr><tr><td class='line-number'><a name='L637' href='#L637'><pre>637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(unsafe { self.get().unwrap_unchecked() })</span></pre></td></tr><tr><td class='line-number'><a name='L638' href='#L638'><pre>638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L639' href='#L639'><pre>639</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L640' href='#L640'><pre>640</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Takes the value out of this `OnceCell`, moving it back to an uninitialized state.</pre></td></tr><tr><td class='line-number'><a name='L641' href='#L641'><pre>641</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L642' href='#L642'><pre>642</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Has no effect and returns `None` if the `OnceCell` hasn't been initialized.</pre></td></tr><tr><td class='line-number'><a name='L643' href='#L643'><pre>643</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L644' href='#L644'><pre>644</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Examples</pre></td></tr><tr><td class='line-number'><a name='L645' href='#L645'><pre>645</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L646' href='#L646'><pre>646</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L647' href='#L647'><pre>647</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L648' href='#L648'><pre>648</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L649' href='#L649'><pre>649</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell: OnceCell<String> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L650' href='#L650'><pre>650</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.take(), None);</pre></td></tr><tr><td class='line-number'><a name='L651' href='#L651'><pre>651</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L652' href='#L652'><pre>652</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L653' href='#L653'><pre>653</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell.set("hello".to_string()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L654' href='#L654'><pre>654</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.take(), Some("hello".to_string()));</pre></td></tr><tr><td class='line-number'><a name='L655' href='#L655'><pre>655</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.get(), None);</pre></td></tr><tr><td class='line-number'><a name='L656' href='#L656'><pre>656</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L657' href='#L657'><pre>657</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L658' href='#L658'><pre>658</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method is allowed to violate the invariant of writing to a `OnceCell`</pre></td></tr><tr><td class='line-number'><a name='L659' href='#L659'><pre>659</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// at most once because it requires `&mut` access to `self`. As with all</pre></td></tr><tr><td class='line-number'><a name='L660' href='#L660'><pre>660</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// interior mutability, `&mut` access permits arbitrary modification:</pre></td></tr><tr><td class='line-number'><a name='L661' href='#L661'><pre>661</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L662' href='#L662'><pre>662</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L663' href='#L663'><pre>663</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L664' href='#L664'><pre>664</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L665' href='#L665'><pre>665</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell: OnceCell<u32> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L666' href='#L666'><pre>666</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell.set(92).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L667' href='#L667'><pre>667</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L668' href='#L668'><pre>668</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L669' href='#L669'><pre>669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn take(&mut self) -> Option<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L670' href='#L670'><pre>670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> mem::take(self).into_inner()</span></pre></td></tr><tr><td class='line-number'><a name='L671' href='#L671'><pre>671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L672' href='#L672'><pre>672</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L673' href='#L673'><pre>673</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Consumes the `OnceCell`, returning the wrapped value.</pre></td></tr><tr><td class='line-number'><a name='L674' href='#L674'><pre>674</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L675' href='#L675'><pre>675</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `None` if the cell was empty.</pre></td></tr><tr><td class='line-number'><a name='L676' href='#L676'><pre>676</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L677' href='#L677'><pre>677</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Examples</pre></td></tr><tr><td class='line-number'><a name='L678' href='#L678'><pre>678</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L679' href='#L679'><pre>679</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L680' href='#L680'><pre>680</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L681' href='#L681'><pre>681</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L682' href='#L682'><pre>682</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell: OnceCell<String> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L683' href='#L683'><pre>683</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.into_inner(), None);</pre></td></tr><tr><td class='line-number'><a name='L684' href='#L684'><pre>684</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L685' href='#L685'><pre>685</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L686' href='#L686'><pre>686</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell.set("hello".to_string()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L687' href='#L687'><pre>687</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.into_inner(), Some("hello".to_string()));</pre></td></tr><tr><td class='line-number'><a name='L688' href='#L688'><pre>688</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L689' href='#L689'><pre>689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn into_inner(self) -> Option<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L690' href='#L690'><pre>690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Because `into_inner` takes `self` by value, the compiler statically verifies</span></pre></td></tr><tr><td class='line-number'><a name='L691' href='#L691'><pre>691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // that it is not currently borrowed. So it is safe to move out `Option<T>`.</span></pre></td></tr><tr><td class='line-number'><a name='L692' href='#L692'><pre>692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.inner.into_inner()</span></pre></td></tr><tr><td class='line-number'><a name='L693' href='#L693'><pre>693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L694' href='#L694'><pre>694</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L695' href='#L695'><pre>695</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L696' href='#L696'><pre>696</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A value which is initialized on the first access.</pre></td></tr><tr><td class='line-number'><a name='L697' href='#L697'><pre>697</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L698' href='#L698'><pre>698</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L699' href='#L699'><pre>699</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L700' href='#L700'><pre>700</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L701' href='#L701'><pre>701</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L702' href='#L702'><pre>702</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let lazy: Lazy<i32> = Lazy::new(|| {</pre></td></tr><tr><td class='line-number'><a name='L703' href='#L703'><pre>703</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// println!("initializing");</pre></td></tr><tr><td class='line-number'><a name='L704' href='#L704'><pre>704</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// 92</pre></td></tr><tr><td class='line-number'><a name='L705' href='#L705'><pre>705</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// });</pre></td></tr><tr><td class='line-number'><a name='L706' href='#L706'><pre>706</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// println!("ready");</pre></td></tr><tr><td class='line-number'><a name='L707' href='#L707'><pre>707</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// println!("{}", *lazy);</pre></td></tr><tr><td class='line-number'><a name='L708' href='#L708'><pre>708</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// println!("{}", *lazy);</pre></td></tr><tr><td class='line-number'><a name='L709' href='#L709'><pre>709</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L710' href='#L710'><pre>710</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // Prints:</pre></td></tr><tr><td class='line-number'><a name='L711' href='#L711'><pre>711</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // ready</pre></td></tr><tr><td class='line-number'><a name='L712' href='#L712'><pre>712</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // initializing</pre></td></tr><tr><td class='line-number'><a name='L713' href='#L713'><pre>713</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // 92</pre></td></tr><tr><td class='line-number'><a name='L714' href='#L714'><pre>714</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // 92</pre></td></tr><tr><td class='line-number'><a name='L715' href='#L715'><pre>715</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L716' href='#L716'><pre>716</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub struct Lazy<T, F = fn() -> T> {</pre></td></tr><tr><td class='line-number'><a name='L717' href='#L717'><pre>717</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cell: OnceCell<T>,</pre></td></tr><tr><td class='line-number'><a name='L718' href='#L718'><pre>718</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> init: Cell<Option<F>>,</pre></td></tr><tr><td class='line-number'><a name='L719' href='#L719'><pre>719</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L720' href='#L720'><pre>720</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L721' href='#L721'><pre>721</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F: RefUnwindSafe> RefUnwindSafe for Lazy<T, F> where OnceCell<T>: RefUnwindSafe {}</pre></td></tr><tr><td class='line-number'><a name='L722' href='#L722'><pre>722</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L723' href='#L723'><pre>723</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: fmt::Debug, F> fmt::Debug for Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L724' href='#L724'><pre>724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L725' href='#L725'><pre>725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> f.debug_struct("Lazy").field("cell", &self.cell).field("init", &"..").finish()</span></pre></td></tr><tr><td class='line-number'><a name='L726' href='#L726'><pre>726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L727' href='#L727'><pre>727</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L728' href='#L728'><pre>728</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L729' href='#L729'><pre>729</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F> Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L730' href='#L730'><pre>730</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new lazy value with the given initializing function.</pre></td></tr><tr><td class='line-number'><a name='L731' href='#L731'><pre>731</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L732' href='#L732'><pre>732</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L733' href='#L733'><pre>733</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L734' href='#L734'><pre>734</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # fn main() {</pre></td></tr><tr><td class='line-number'><a name='L735' href='#L735'><pre>735</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L736' href='#L736'><pre>736</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L737' href='#L737'><pre>737</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let hello = "Hello, World!".to_string();</pre></td></tr><tr><td class='line-number'><a name='L738' href='#L738'><pre>738</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L739' href='#L739'><pre>739</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let lazy = Lazy::new(|| hello.to_uppercase());</pre></td></tr><tr><td class='line-number'><a name='L740' href='#L740'><pre>740</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L741' href='#L741'><pre>741</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&*lazy, "HELLO, WORLD!");</pre></td></tr><tr><td class='line-number'><a name='L742' href='#L742'><pre>742</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # }</pre></td></tr><tr><td class='line-number'><a name='L743' href='#L743'><pre>743</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L744' href='#L744'><pre>744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new(init: F) -> Lazy<T, F> {</span></pre></td></tr><tr><td class='line-number'><a name='L745' href='#L745'><pre>745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Lazy { cell: OnceCell::new(), init: Cell::new(Some(init)) }</span></pre></td></tr><tr><td class='line-number'><a name='L746' href='#L746'><pre>746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L747' href='#L747'><pre>747</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L748' href='#L748'><pre>748</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Consumes this `Lazy` returning the stored value.</pre></td></tr><tr><td class='line-number'><a name='L749' href='#L749'><pre>749</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L750' href='#L750'><pre>750</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `Ok(value)` if `Lazy` is initialized and `Err(f)` otherwise.</pre></td></tr><tr><td class='line-number'><a name='L751' href='#L751'><pre>751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn into_value(this: Lazy<T, F>) -> Result<T, F> {</span></pre></td></tr><tr><td class='line-number'><a name='L752' href='#L752'><pre>752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let cell = this.cell;</span></pre></td></tr><tr><td class='line-number'><a name='L753' href='#L753'><pre>753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let init = this.init;</span></pre></td></tr><tr><td class='line-number'><a name='L754' href='#L754'><pre>754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cell.into_inner().ok_or_else(</span>|| <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L755' href='#L755'><pre>755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> init.take().unwrap_or_else(</span>|| <span class='red'>panic!("Lazy instance has previously been poisoned"</span>)<span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L756' href='#L756'><pre>756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L757' href='#L757'><pre>757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L758' href='#L758'><pre>758</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L759' href='#L759'><pre>759</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L760' href='#L760'><pre>760</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F: FnOnce() -> T> Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L761' href='#L761'><pre>761</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Forces the evaluation of this lazy value and returns a reference to</pre></td></tr><tr><td class='line-number'><a name='L762' href='#L762'><pre>762</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the result.</pre></td></tr><tr><td class='line-number'><a name='L763' href='#L763'><pre>763</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L764' href='#L764'><pre>764</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This is equivalent to the `Deref` impl, but is explicit.</pre></td></tr><tr><td class='line-number'><a name='L765' href='#L765'><pre>765</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L766' href='#L766'><pre>766</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L767' href='#L767'><pre>767</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L768' href='#L768'><pre>768</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L769' href='#L769'><pre>769</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L770' href='#L770'><pre>770</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let lazy = Lazy::new(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L771' href='#L771'><pre>771</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L772' href='#L772'><pre>772</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::force(&lazy), &92);</pre></td></tr><tr><td class='line-number'><a name='L773' href='#L773'><pre>773</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&*lazy, &92);</pre></td></tr><tr><td class='line-number'><a name='L774' href='#L774'><pre>774</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L775' href='#L775'><pre>775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn force(this: &Lazy<T, F>) -> &T {</span></pre></td></tr><tr><td class='line-number'><a name='L776' href='#L776'><pre>776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> this.cell.get_or_init(</span>|| <span class='red'>match this.init.take()</span> {</pre></td></tr><tr><td class='line-number'><a name='L777' href='#L777'><pre>777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>f) => f()</span>,</pre></td></tr><tr><td class='line-number'><a name='L778' href='#L778'><pre>778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>panic!("Lazy instance has previously been poisoned")</span>,</pre></td></tr><tr><td class='line-number'><a name='L779' href='#L779'><pre>779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L780' href='#L780'><pre>780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L781' href='#L781'><pre>781</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L782' href='#L782'><pre>782</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Forces the evaluation of this lazy value and returns a mutable reference to</pre></td></tr><tr><td class='line-number'><a name='L783' href='#L783'><pre>783</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the result.</pre></td></tr><tr><td class='line-number'><a name='L784' href='#L784'><pre>784</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L785' href='#L785'><pre>785</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This is equivalent to the `DerefMut` impl, but is explicit.</pre></td></tr><tr><td class='line-number'><a name='L786' href='#L786'><pre>786</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L787' href='#L787'><pre>787</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L788' href='#L788'><pre>788</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L789' href='#L789'><pre>789</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L790' href='#L790'><pre>790</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L791' href='#L791'><pre>791</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut lazy = Lazy::new(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L792' href='#L792'><pre>792</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L793' href='#L793'><pre>793</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::force_mut(&mut lazy), &92);</pre></td></tr><tr><td class='line-number'><a name='L794' href='#L794'><pre>794</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(*lazy, 92);</pre></td></tr><tr><td class='line-number'><a name='L795' href='#L795'><pre>795</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L796' href='#L796'><pre>796</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn force_mut(this: &mut Lazy<T, F>) -> &mut T {</span></pre></td></tr><tr><td class='line-number'><a name='L797' href='#L797'><pre>797</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if this.cell.get_mut().is_none()</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L798' href='#L798'><pre>798</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let value</span> = match <span class='red'>this.init.get_mut().take()</span> {</pre></td></tr><tr><td class='line-number'><a name='L799' href='#L799'><pre>799</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>f) => f()</span>,</pre></td></tr><tr><td class='line-number'><a name='L800' href='#L800'><pre>800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>panic!("Lazy instance has previously been poisoned")</span>,</pre></td></tr><tr><td class='line-number'><a name='L801' href='#L801'><pre>801</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L802' href='#L802'><pre>802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>this.cell = OnceCell::with_value(value)</span>;</pre></td></tr><tr><td class='line-number'><a name='L803' href='#L803'><pre>803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L804' href='#L804'><pre>804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>this.cell.get_mut().unwrap_or_else(</span>|| <span class='red'>unreachable!()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L805' href='#L805'><pre>805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L806' href='#L806'><pre>806</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L807' href='#L807'><pre>807</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the reference to the result of this lazy value if</pre></td></tr><tr><td class='line-number'><a name='L808' href='#L808'><pre>808</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// it was initialized, otherwise returns `None`.</pre></td></tr><tr><td class='line-number'><a name='L809' href='#L809'><pre>809</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L810' href='#L810'><pre>810</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L811' href='#L811'><pre>811</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L812' href='#L812'><pre>812</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L813' href='#L813'><pre>813</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L814' href='#L814'><pre>814</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let lazy = Lazy::new(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L815' href='#L815'><pre>815</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L816' href='#L816'><pre>816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::get(&lazy), None);</pre></td></tr><tr><td class='line-number'><a name='L817' href='#L817'><pre>817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&*lazy, &92);</pre></td></tr><tr><td class='line-number'><a name='L818' href='#L818'><pre>818</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::get(&lazy), Some(&92));</pre></td></tr><tr><td class='line-number'><a name='L819' href='#L819'><pre>819</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L820' href='#L820'><pre>820</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get(this: &Lazy<T, F>) -> Option<&T> {</span></pre></td></tr><tr><td class='line-number'><a name='L821' href='#L821'><pre>821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> this.cell.get()</span></pre></td></tr><tr><td class='line-number'><a name='L822' href='#L822'><pre>822</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L823' href='#L823'><pre>823</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L824' href='#L824'><pre>824</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the mutable reference to the result of this lazy value if</pre></td></tr><tr><td class='line-number'><a name='L825' href='#L825'><pre>825</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// it was initialized, otherwise returns `None`.</pre></td></tr><tr><td class='line-number'><a name='L826' href='#L826'><pre>826</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L827' href='#L827'><pre>827</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L828' href='#L828'><pre>828</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L829' href='#L829'><pre>829</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L830' href='#L830'><pre>830</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L831' href='#L831'><pre>831</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut lazy = Lazy::new(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L832' href='#L832'><pre>832</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L833' href='#L833'><pre>833</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::get_mut(&mut lazy), None);</pre></td></tr><tr><td class='line-number'><a name='L834' href='#L834'><pre>834</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(*lazy, 92);</pre></td></tr><tr><td class='line-number'><a name='L835' href='#L835'><pre>835</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::get_mut(&mut lazy), Some(&mut 92));</pre></td></tr><tr><td class='line-number'><a name='L836' href='#L836'><pre>836</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L837' href='#L837'><pre>837</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_mut(this: &mut Lazy<T, F>) -> Option<&mut T> {</span></pre></td></tr><tr><td class='line-number'><a name='L838' href='#L838'><pre>838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> this.cell.get_mut()</span></pre></td></tr><tr><td class='line-number'><a name='L839' href='#L839'><pre>839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L840' href='#L840'><pre>840</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L841' href='#L841'><pre>841</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L842' href='#L842'><pre>842</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F: FnOnce() -> T> Deref for Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L843' href='#L843'><pre>843</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Target = T;</pre></td></tr><tr><td class='line-number'><a name='L844' href='#L844'><pre>844</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn deref(&self) -> &T {</span></pre></td></tr><tr><td class='line-number'><a name='L845' href='#L845'><pre>845</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Lazy::force(self)</span></pre></td></tr><tr><td class='line-number'><a name='L846' href='#L846'><pre>846</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L847' href='#L847'><pre>847</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L848' href='#L848'><pre>848</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L849' href='#L849'><pre>849</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F: FnOnce() -> T> DerefMut for Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L850' href='#L850'><pre>850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn deref_mut(&mut self) -> &mut T {</span></pre></td></tr><tr><td class='line-number'><a name='L851' href='#L851'><pre>851</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Lazy::force_mut(self)</span></pre></td></tr><tr><td class='line-number'><a name='L852' href='#L852'><pre>852</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L853' href='#L853'><pre>853</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L854' href='#L854'><pre>854</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L855' href='#L855'><pre>855</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: Default> Default for Lazy<T> {</pre></td></tr><tr><td class='line-number'><a name='L856' href='#L856'><pre>856</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new lazy value using `Default` as the initializing function.</pre></td></tr><tr><td class='line-number'><a name='L857' href='#L857'><pre>857</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn default() -> Lazy<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L858' href='#L858'><pre>858</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Lazy::new(T::default)</span></pre></td></tr><tr><td class='line-number'><a name='L859' href='#L859'><pre>859</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L860' href='#L860'><pre>860</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L861' href='#L861'><pre>861</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L862' href='#L862'><pre>862</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L863' href='#L863'><pre>863</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Thread-safe, blocking version of `OnceCell`.</pre></td></tr><tr><td class='line-number'><a name='L864' href='#L864'><pre>864</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(any(feature = "std", feature = "critical-section"))]</pre></td></tr><tr><td class='line-number'><a name='L865' href='#L865'><pre>865</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod sync {</pre></td></tr><tr><td class='line-number'><a name='L866' href='#L866'><pre>866</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use core::{</pre></td></tr><tr><td class='line-number'><a name='L867' href='#L867'><pre>867</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cell::Cell,</pre></td></tr><tr><td class='line-number'><a name='L868' href='#L868'><pre>868</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fmt, mem,</pre></td></tr><tr><td class='line-number'><a name='L869' href='#L869'><pre>869</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ops::{Deref, DerefMut},</pre></td></tr><tr><td class='line-number'><a name='L870' href='#L870'><pre>870</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> panic::RefUnwindSafe,</pre></td></tr><tr><td class='line-number'><a name='L871' href='#L871'><pre>871</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L872' href='#L872'><pre>872</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L873' href='#L873'><pre>873</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::imp::OnceCell as Imp;</pre></td></tr><tr><td class='line-number'><a name='L874' href='#L874'><pre>874</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L875' href='#L875'><pre>875</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A thread-safe cell which can be written to only once.</pre></td></tr><tr><td class='line-number'><a name='L876' href='#L876'><pre>876</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L877' href='#L877'><pre>877</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// `OnceCell` provides `&` references to the contents without RAII guards.</pre></td></tr><tr><td class='line-number'><a name='L878' href='#L878'><pre>878</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L879' href='#L879'><pre>879</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Reading a non-`None` value out of `OnceCell` establishes a</pre></td></tr><tr><td class='line-number'><a name='L880' href='#L880'><pre>880</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// happens-before relationship with a corresponding write. For example, if</pre></td></tr><tr><td class='line-number'><a name='L881' href='#L881'><pre>881</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// thread A initializes the cell with `get_or_init(f)`, and thread B</pre></td></tr><tr><td class='line-number'><a name='L882' href='#L882'><pre>882</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// subsequently reads the result of this call, B also observes all the side</pre></td></tr><tr><td class='line-number'><a name='L883' href='#L883'><pre>883</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// effects of `f`.</pre></td></tr><tr><td class='line-number'><a name='L884' href='#L884'><pre>884</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L885' href='#L885'><pre>885</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L886' href='#L886'><pre>886</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L887' href='#L887'><pre>887</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L888' href='#L888'><pre>888</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L889' href='#L889'><pre>889</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// static CELL: OnceCell<String> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L890' href='#L890'><pre>890</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(CELL.get().is_none());</pre></td></tr><tr><td class='line-number'><a name='L891' href='#L891'><pre>891</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L892' href='#L892'><pre>892</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// std::thread::spawn(|| {</pre></td></tr><tr><td class='line-number'><a name='L893' href='#L893'><pre>893</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value: &String = CELL.get_or_init(|| {</pre></td></tr><tr><td class='line-number'><a name='L894' href='#L894'><pre>894</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// "Hello, World!".to_string()</pre></td></tr><tr><td class='line-number'><a name='L895' href='#L895'><pre>895</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// });</pre></td></tr><tr><td class='line-number'><a name='L896' href='#L896'><pre>896</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value, "Hello, World!");</pre></td></tr><tr><td class='line-number'><a name='L897' href='#L897'><pre>897</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// }).join().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L898' href='#L898'><pre>898</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L899' href='#L899'><pre>899</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value: Option<&String> = CELL.get();</pre></td></tr><tr><td class='line-number'><a name='L900' href='#L900'><pre>900</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(value.is_some());</pre></td></tr><tr><td class='line-number'><a name='L901' href='#L901'><pre>901</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value.unwrap().as_str(), "Hello, World!");</pre></td></tr><tr><td class='line-number'><a name='L902' href='#L902'><pre>902</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L903' href='#L903'><pre>903</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub struct OnceCell<T>(Imp<T>);</pre></td></tr><tr><td class='line-number'><a name='L904' href='#L904'><pre>904</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L905' href='#L905'><pre>905</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> Default for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L906' href='#L906'><pre>906</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn default() -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L907' href='#L907'><pre>907</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceCell::new()</span></pre></td></tr><tr><td class='line-number'><a name='L908' href='#L908'><pre>908</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L909' href='#L909'><pre>909</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L910' href='#L910'><pre>910</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L911' href='#L911'><pre>911</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: fmt::Debug> fmt::Debug for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L912' href='#L912'><pre>912</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L913' href='#L913'><pre>913</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get()</span> {</pre></td></tr><tr><td class='line-number'><a name='L914' href='#L914'><pre>914</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>v) => f.debug_tuple("OnceCell").field(v).finish()</span>,</pre></td></tr><tr><td class='line-number'><a name='L915' href='#L915'><pre>915</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>f.write_str("OnceCell(Uninit)")</span>,</pre></td></tr><tr><td class='line-number'><a name='L916' href='#L916'><pre>916</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L917' href='#L917'><pre>917</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L918' href='#L918'><pre>918</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L919' href='#L919'><pre>919</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L920' href='#L920'><pre>920</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: Clone> Clone for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L921' href='#L921'><pre>921</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn clone(&self) -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L922' href='#L922'><pre>922</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get()</span> {</pre></td></tr><tr><td class='line-number'><a name='L923' href='#L923'><pre>923</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>value) => Self::with_value(value.clone())</span>,</pre></td></tr><tr><td class='line-number'><a name='L924' href='#L924'><pre>924</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>Self::new()</span>,</pre></td></tr><tr><td class='line-number'><a name='L925' href='#L925'><pre>925</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L926' href='#L926'><pre>926</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L927' href='#L927'><pre>927</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L928' href='#L928'><pre>928</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn clone_from(&mut self, source: &Self) {</pre></td></tr><tr><td class='line-number'><a name='L929' href='#L929'><pre>929</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> match (<span class='red'>self.get_mut(), source.get()</span>) {</pre></td></tr><tr><td class='line-number'><a name='L930' href='#L930'><pre>930</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (Some(<span class='red'>this), Some(source)) => this.clone_from(source)</span>,</pre></td></tr><tr><td class='line-number'><a name='L931' href='#L931'><pre>931</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> _ => <span class='red'>*self = source.clone()</span>,</pre></td></tr><tr><td class='line-number'><a name='L932' href='#L932'><pre>932</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L933' href='#L933'><pre>933</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L934' href='#L934'><pre>934</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L935' href='#L935'><pre>935</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L936' href='#L936'><pre>936</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> From<T> for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L937' href='#L937'><pre>937</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(value: T) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L938' href='#L938'><pre>938</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Self::with_value(value)</span></pre></td></tr><tr><td class='line-number'><a name='L939' href='#L939'><pre>939</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L940' href='#L940'><pre>940</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L941' href='#L941'><pre>941</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L942' href='#L942'><pre>942</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: PartialEq> PartialEq for OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L943' href='#L943'><pre>943</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn eq(&self, other: &OnceCell<T>) -> bool {</span></pre></td></tr><tr><td class='line-number'><a name='L944' href='#L944'><pre>944</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.get() == other.get()</span></pre></td></tr><tr><td class='line-number'><a name='L945' href='#L945'><pre>945</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L946' href='#L946'><pre>946</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L947' href='#L947'><pre>947</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L948' href='#L948'><pre>948</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: Eq> Eq for OnceCell<T> {}</pre></td></tr><tr><td class='line-number'><a name='L949' href='#L949'><pre>949</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L950' href='#L950'><pre>950</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> OnceCell<T> {</pre></td></tr><tr><td class='line-number'><a name='L951' href='#L951'><pre>951</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new empty cell.</pre></td></tr><tr><td class='line-number'><a name='L952' href='#L952'><pre>952</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new() -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L953' href='#L953'><pre>953</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceCell(Imp::new())</span></pre></td></tr><tr><td class='line-number'><a name='L954' href='#L954'><pre>954</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L955' href='#L955'><pre>955</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L956' href='#L956'><pre>956</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new initialized cell.</pre></td></tr><tr><td class='line-number'><a name='L957' href='#L957'><pre>957</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn with_value(value: T) -> OnceCell<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L958' href='#L958'><pre>958</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceCell(Imp::with_value(value))</span></pre></td></tr><tr><td class='line-number'><a name='L959' href='#L959'><pre>959</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L960' href='#L960'><pre>960</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L961' href='#L961'><pre>961</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the reference to the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L962' href='#L962'><pre>962</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L963' href='#L963'><pre>963</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `None` if the cell is empty, or being initialized. This</pre></td></tr><tr><td class='line-number'><a name='L964' href='#L964'><pre>964</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// method never blocks.</pre></td></tr><tr><td class='line-number'><a name='L965' href='#L965'><pre>965</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn get(&self) -> Option<&T> {</pre></td></tr><tr><td class='line-number'><a name='L966' href='#L966'><pre>966</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.0.is_initialized() {</pre></td></tr><tr><td class='line-number'><a name='L967' href='#L967'><pre>967</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Safe b/c value is initialized.</pre></td></tr><tr><td class='line-number'><a name='L968' href='#L968'><pre>968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Some(unsafe { self.get_unchecked() })</span></pre></td></tr><tr><td class='line-number'><a name='L969' href='#L969'><pre>969</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L970' href='#L970'><pre>970</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> None</pre></td></tr><tr><td class='line-number'><a name='L971' href='#L971'><pre>971</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L972' href='#L972'><pre>972</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE3getCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L965' href='#L965'><pre>965</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn get(&self) -> Option<&T> {</pre></td></tr><tr><td class='line-number'><a name='L966' href='#L966'><pre>966</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.0.is_initialized() {</pre></td></tr><tr><td class='line-number'><a name='L967' href='#L967'><pre>967</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Safe b/c value is initialized.</pre></td></tr><tr><td class='line-number'><a name='L968' href='#L968'><pre>968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Some(unsafe { self.get_unchecked() })</span></pre></td></tr><tr><td class='line-number'><a name='L969' href='#L969'><pre>969</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L970' href='#L970'><pre>970</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> None</pre></td></tr><tr><td class='line-number'><a name='L971' href='#L971'><pre>971</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L972' href='#L972'><pre>972</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE3getCsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellpE3getB7_</pre></div></div></td></tr><tr><td class='line-number'><a name='L973' href='#L973'><pre>973</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L974' href='#L974'><pre>974</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the reference to the underlying value, blocking the current</pre></td></tr><tr><td class='line-number'><a name='L975' href='#L975'><pre>975</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// thread until it is set.</pre></td></tr><tr><td class='line-number'><a name='L976' href='#L976'><pre>976</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L977' href='#L977'><pre>977</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L978' href='#L978'><pre>978</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L979' href='#L979'><pre>979</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L980' href='#L980'><pre>980</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell = std::sync::Arc::new(OnceCell::new());</pre></td></tr><tr><td class='line-number'><a name='L981' href='#L981'><pre>981</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let t = std::thread::spawn({</pre></td></tr><tr><td class='line-number'><a name='L982' href='#L982'><pre>982</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = std::sync::Arc::clone(&cell);</pre></td></tr><tr><td class='line-number'><a name='L983' href='#L983'><pre>983</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// move || cell.set(92).unwrap()</pre></td></tr><tr><td class='line-number'><a name='L984' href='#L984'><pre>984</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// });</pre></td></tr><tr><td class='line-number'><a name='L985' href='#L985'><pre>985</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L986' href='#L986'><pre>986</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // Returns immediately, but might return None.</pre></td></tr><tr><td class='line-number'><a name='L987' href='#L987'><pre>987</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let _value_or_none = cell.get();</pre></td></tr><tr><td class='line-number'><a name='L988' href='#L988'><pre>988</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L989' href='#L989'><pre>989</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // Will return 92, but might block until the other thread does `.set`.</pre></td></tr><tr><td class='line-number'><a name='L990' href='#L990'><pre>990</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value: &u32 = cell.wait();</pre></td></tr><tr><td class='line-number'><a name='L991' href='#L991'><pre>991</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(*value, 92);</pre></td></tr><tr><td class='line-number'><a name='L992' href='#L992'><pre>992</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// t.join().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L993' href='#L993'><pre>993</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L994' href='#L994'><pre>994</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[cfg(feature = "std")]</pre></td></tr><tr><td class='line-number'><a name='L995' href='#L995'><pre>995</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn wait(&self) -> &T {</span></pre></td></tr><tr><td class='line-number'><a name='L996' href='#L996'><pre>996</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if !self.0.is_initialized()</span> {</pre></td></tr><tr><td class='line-number'><a name='L997' href='#L997'><pre>997</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.0.wait()</span></pre></td></tr><tr><td class='line-number'><a name='L998' href='#L998'><pre>998</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L999' href='#L999'><pre>999</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> debug_assert!(<span class='red'>self.0.is_initialized()</span>);</pre></td></tr><tr><td class='line-number'><a name='L1000' href='#L1000'><pre>1000</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Safe b/c of the wait call above and the fact that we didn't</pre></td></tr><tr><td class='line-number'><a name='L1001' href='#L1001'><pre>1001</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // relinquish our borrow.</pre></td></tr><tr><td class='line-number'><a name='L1002' href='#L1002'><pre>1002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> unsafe { <span class='red'>self.get_unchecked() }</span></pre></td></tr><tr><td class='line-number'><a name='L1003' href='#L1003'><pre>1003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1004' href='#L1004'><pre>1004</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1005' href='#L1005'><pre>1005</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the mutable reference to the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L1006' href='#L1006'><pre>1006</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1007' href='#L1007'><pre>1007</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `None` if the cell is empty.</pre></td></tr><tr><td class='line-number'><a name='L1008' href='#L1008'><pre>1008</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1009' href='#L1009'><pre>1009</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method is allowed to violate the invariant of writing to a `OnceCell`</pre></td></tr><tr><td class='line-number'><a name='L1010' href='#L1010'><pre>1010</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// at most once because it requires `&mut` access to `self`. As with all</pre></td></tr><tr><td class='line-number'><a name='L1011' href='#L1011'><pre>1011</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// interior mutability, `&mut` access permits arbitrary modification:</pre></td></tr><tr><td class='line-number'><a name='L1012' href='#L1012'><pre>1012</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1013' href='#L1013'><pre>1013</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1014' href='#L1014'><pre>1014</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L1015' href='#L1015'><pre>1015</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1016' href='#L1016'><pre>1016</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell: OnceCell<u32> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1017' href='#L1017'><pre>1017</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell.set(92).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L1018' href='#L1018'><pre>1018</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1019' href='#L1019'><pre>1019</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1020' href='#L1020'><pre>1020</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L1021' href='#L1021'><pre>1021</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_mut(&mut self) -> Option<&mut T> {</span></pre></td></tr><tr><td class='line-number'><a name='L1022' href='#L1022'><pre>1022</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.0.get_mut()</span></pre></td></tr><tr><td class='line-number'><a name='L1023' href='#L1023'><pre>1023</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1024' href='#L1024'><pre>1024</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1025' href='#L1025'><pre>1025</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Get the reference to the underlying value, without checking if the</pre></td></tr><tr><td class='line-number'><a name='L1026' href='#L1026'><pre>1026</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell is initialized.</pre></td></tr><tr><td class='line-number'><a name='L1027' href='#L1027'><pre>1027</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1028' href='#L1028'><pre>1028</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Safety</pre></td></tr><tr><td class='line-number'><a name='L1029' href='#L1029'><pre>1029</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1030' href='#L1030'><pre>1030</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Caller must ensure that the cell is in initialized state, and that</pre></td></tr><tr><td class='line-number'><a name='L1031' href='#L1031'><pre>1031</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the contents are acquired by (synchronized to) this thread.</pre></td></tr><tr><td class='line-number'><a name='L1032' href='#L1032'><pre>1032</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L1033' href='#L1033'><pre>1033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub unsafe fn get_unchecked(&self) -> &T {</span></pre></td></tr><tr><td class='line-number'><a name='L1034' href='#L1034'><pre>1034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.0.get_unchecked()</span></pre></td></tr><tr><td class='line-number'><a name='L1035' href='#L1035'><pre>1035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE13get_uncheckedCsgg978DXfVXR_13fuzz_target_1</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE13get_uncheckedCsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellpE13get_uncheckedB7_</pre></div></div></td></tr><tr><td class='line-number'><a name='L1036' href='#L1036'><pre>1036</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1037' href='#L1037'><pre>1037</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Sets the contents of this cell to `value`.</pre></td></tr><tr><td class='line-number'><a name='L1038' href='#L1038'><pre>1038</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1039' href='#L1039'><pre>1039</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `Ok(())` if the cell was empty and `Err(value)` if it was</pre></td></tr><tr><td class='line-number'><a name='L1040' href='#L1040'><pre>1040</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// full.</pre></td></tr><tr><td class='line-number'><a name='L1041' href='#L1041'><pre>1041</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1042' href='#L1042'><pre>1042</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1043' href='#L1043'><pre>1043</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1044' href='#L1044'><pre>1044</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1045' href='#L1045'><pre>1045</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L1046' href='#L1046'><pre>1046</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1047' href='#L1047'><pre>1047</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// static CELL: OnceCell<i32> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1048' href='#L1048'><pre>1048</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1049' href='#L1049'><pre>1049</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// fn main() {</pre></td></tr><tr><td class='line-number'><a name='L1050' href='#L1050'><pre>1050</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(CELL.get().is_none());</pre></td></tr><tr><td class='line-number'><a name='L1051' href='#L1051'><pre>1051</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1052' href='#L1052'><pre>1052</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// std::thread::spawn(|| {</pre></td></tr><tr><td class='line-number'><a name='L1053' href='#L1053'><pre>1053</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(CELL.set(92), Ok(()));</pre></td></tr><tr><td class='line-number'><a name='L1054' href='#L1054'><pre>1054</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// }).join().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L1055' href='#L1055'><pre>1055</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1056' href='#L1056'><pre>1056</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(CELL.set(62), Err(62));</pre></td></tr><tr><td class='line-number'><a name='L1057' href='#L1057'><pre>1057</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(CELL.get(), Some(&92));</pre></td></tr><tr><td class='line-number'><a name='L1058' href='#L1058'><pre>1058</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// }</pre></td></tr><tr><td class='line-number'><a name='L1059' href='#L1059'><pre>1059</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1060' href='#L1060'><pre>1060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn set(&self, value: T) -> Result<(), T> {</span></pre></td></tr><tr><td class='line-number'><a name='L1061' href='#L1061'><pre>1061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.try_insert(value)</span> {</pre></td></tr><tr><td class='line-number'><a name='L1062' href='#L1062'><pre>1062</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(_) => <span class='red'>Ok(())</span>,</pre></td></tr><tr><td class='line-number'><a name='L1063' href='#L1063'><pre>1063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Err((_, <span class='red'>value)) => Err(value)</span>,</pre></td></tr><tr><td class='line-number'><a name='L1064' href='#L1064'><pre>1064</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1065' href='#L1065'><pre>1065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE3setCsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellpE3setB7_</pre></div></div></td></tr><tr><td class='line-number'><a name='L1066' href='#L1066'><pre>1066</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1067' href='#L1067'><pre>1067</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Like [`set`](Self::set), but also returns a reference to the final cell value.</pre></td></tr><tr><td class='line-number'><a name='L1068' href='#L1068'><pre>1068</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1069' href='#L1069'><pre>1069</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1070' href='#L1070'><pre>1070</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1071' href='#L1071'><pre>1071</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1072' href='#L1072'><pre>1072</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::unsync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L1073' href='#L1073'><pre>1073</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1074' href='#L1074'><pre>1074</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1075' href='#L1075'><pre>1075</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_none());</pre></td></tr><tr><td class='line-number'><a name='L1076' href='#L1076'><pre>1076</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1077' href='#L1077'><pre>1077</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.try_insert(92), Ok(&92));</pre></td></tr><tr><td class='line-number'><a name='L1078' href='#L1078'><pre>1078</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.try_insert(62), Err((&92, 62)));</pre></td></tr><tr><td class='line-number'><a name='L1079' href='#L1079'><pre>1079</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1080' href='#L1080'><pre>1080</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_some());</pre></td></tr><tr><td class='line-number'><a name='L1081' href='#L1081'><pre>1081</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1082' href='#L1082'><pre>1082</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn try_insert(&self, value: T) -> Result<&T, (&T, T)> {</span></pre></td></tr><tr><td class='line-number'><a name='L1083' href='#L1083'><pre>1083</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut value = Some(value);</span></pre></td></tr><tr><td class='line-number'><a name='L1084' href='#L1084'><pre>1084</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let res = self.get_or_init(</span>|| <span class='red'>unsafe { value.take().unwrap_unchecked() }</span><span class='red'>);</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNCNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB7_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE10try_insert0Csi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNCNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB7_8OnceCellpE10try_insert0B9_</pre></div></div></td></tr><tr><td class='line-number'><a name='L1085' href='#L1085'><pre>1085</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match value</span> {</pre></td></tr><tr><td class='line-number'><a name='L1086' href='#L1086'><pre>1086</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>Ok(res)</span>,</pre></td></tr><tr><td class='line-number'><a name='L1087' href='#L1087'><pre>1087</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>value) => Err((res, value))</span>,</pre></td></tr><tr><td class='line-number'><a name='L1088' href='#L1088'><pre>1088</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1089' href='#L1089'><pre>1089</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE10try_insertCsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB5_8OnceCellpE10try_insertB7_</pre></div></div></td></tr><tr><td class='line-number'><a name='L1090' href='#L1090'><pre>1090</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1091' href='#L1091'><pre>1091</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if the cell</pre></td></tr><tr><td class='line-number'><a name='L1092' href='#L1092'><pre>1092</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// was empty.</pre></td></tr><tr><td class='line-number'><a name='L1093' href='#L1093'><pre>1093</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1094' href='#L1094'><pre>1094</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Many threads may call `get_or_init` concurrently with different</pre></td></tr><tr><td class='line-number'><a name='L1095' href='#L1095'><pre>1095</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// initializing functions, but it is guaranteed that only one function</pre></td></tr><tr><td class='line-number'><a name='L1096' href='#L1096'><pre>1096</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// will be executed.</pre></td></tr><tr><td class='line-number'><a name='L1097' href='#L1097'><pre>1097</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1098' href='#L1098'><pre>1098</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Panics</pre></td></tr><tr><td class='line-number'><a name='L1099' href='#L1099'><pre>1099</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1100' href='#L1100'><pre>1100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If `f` panics, the panic is propagated to the caller, and the cell</pre></td></tr><tr><td class='line-number'><a name='L1101' href='#L1101'><pre>1101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// remains uninitialized.</pre></td></tr><tr><td class='line-number'><a name='L1102' href='#L1102'><pre>1102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1103' href='#L1103'><pre>1103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// It is an error to reentrantly initialize the cell from `f`. The</pre></td></tr><tr><td class='line-number'><a name='L1104' href='#L1104'><pre>1104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// exact outcome is unspecified. Current implementation deadlocks, but</pre></td></tr><tr><td class='line-number'><a name='L1105' href='#L1105'><pre>1105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// this may be changed to a panic in the future.</pre></td></tr><tr><td class='line-number'><a name='L1106' href='#L1106'><pre>1106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1107' href='#L1107'><pre>1107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1108' href='#L1108'><pre>1108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1109' href='#L1109'><pre>1109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L1110' href='#L1110'><pre>1110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1111' href='#L1111'><pre>1111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1112' href='#L1112'><pre>1112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value = cell.get_or_init(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L1113' href='#L1113'><pre>1113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value, &92);</pre></td></tr><tr><td class='line-number'><a name='L1114' href='#L1114'><pre>1114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value = cell.get_or_init(|| unreachable!());</pre></td></tr><tr><td class='line-number'><a name='L1115' href='#L1115'><pre>1115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value, &92);</pre></td></tr><tr><td class='line-number'><a name='L1116' href='#L1116'><pre>1116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1117' href='#L1117'><pre>1117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_init<F>(&self, f: F) -> &T</span></pre></td></tr><tr><td class='line-number'><a name='L1118' href='#L1118'><pre>1118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L1119' href='#L1119'><pre>1119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> T,</span></pre></td></tr><tr><td class='line-number'><a name='L1120' href='#L1120'><pre>1120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L1121' href='#L1121'><pre>1121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> enum Void {}</span></pre></td></tr><tr><td class='line-number'><a name='L1122' href='#L1122'><pre>1122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get_or_try_init(</span>|| <span class='red'>Ok::<T, Void>(f())</span><span class='red'>)</span> {</pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNCINvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB8_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE11get_or_initNCNvB4_10try_insert0E0Csi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNCINvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB8_8OnceCellpE11get_or_initpE0Ba_</pre></div></div></td></tr><tr><td class='line-number'><a name='L1123' href='#L1123'><pre>1123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(<span class='red'>val) => val,</span></pre></td></tr><tr><td class='line-number'><a name='L1124' href='#L1124'><pre>1124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Err(void) => match void {},</span></pre></td></tr><tr><td class='line-number'><a name='L1125' href='#L1125'><pre>1125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1126' href='#L1126'><pre>1126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB6_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE11get_or_initNCNvB2_10try_insert0ECsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB6_8OnceCellpE11get_or_initpEB8_</pre></div></div></td></tr><tr><td class='line-number'><a name='L1127' href='#L1127'><pre>1127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1128' href='#L1128'><pre>1128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if</pre></td></tr><tr><td class='line-number'><a name='L1129' href='#L1129'><pre>1129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the cell was empty. If the cell was empty and `f` failed, an</pre></td></tr><tr><td class='line-number'><a name='L1130' href='#L1130'><pre>1130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// error is returned.</pre></td></tr><tr><td class='line-number'><a name='L1131' href='#L1131'><pre>1131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1132' href='#L1132'><pre>1132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Panics</pre></td></tr><tr><td class='line-number'><a name='L1133' href='#L1133'><pre>1133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1134' href='#L1134'><pre>1134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If `f` panics, the panic is propagated to the caller, and</pre></td></tr><tr><td class='line-number'><a name='L1135' href='#L1135'><pre>1135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the cell remains uninitialized.</pre></td></tr><tr><td class='line-number'><a name='L1136' href='#L1136'><pre>1136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1137' href='#L1137'><pre>1137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// It is an error to reentrantly initialize the cell from `f`.</pre></td></tr><tr><td class='line-number'><a name='L1138' href='#L1138'><pre>1138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The exact outcome is unspecified. Current implementation</pre></td></tr><tr><td class='line-number'><a name='L1139' href='#L1139'><pre>1139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// deadlocks, but this may be changed to a panic in the future.</pre></td></tr><tr><td class='line-number'><a name='L1140' href='#L1140'><pre>1140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1141' href='#L1141'><pre>1141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1142' href='#L1142'><pre>1142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1143' href='#L1143'><pre>1143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L1144' href='#L1144'><pre>1144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1145' href='#L1145'><pre>1145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1146' href='#L1146'><pre>1146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.get_or_try_init(|| Err(())), Err(()));</pre></td></tr><tr><td class='line-number'><a name='L1147' href='#L1147'><pre>1147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert!(cell.get().is_none());</pre></td></tr><tr><td class='line-number'><a name='L1148' href='#L1148'><pre>1148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let value = cell.get_or_try_init(|| -> Result<i32, ()> {</pre></td></tr><tr><td class='line-number'><a name='L1149' href='#L1149'><pre>1149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Ok(92)</pre></td></tr><tr><td class='line-number'><a name='L1150' href='#L1150'><pre>1150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// });</pre></td></tr><tr><td class='line-number'><a name='L1151' href='#L1151'><pre>1151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(value, Ok(&92));</pre></td></tr><tr><td class='line-number'><a name='L1152' href='#L1152'><pre>1152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.get(), Some(&92))</pre></td></tr><tr><td class='line-number'><a name='L1153' href='#L1153'><pre>1153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1154' href='#L1154'><pre>1154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E></span></pre></td></tr><tr><td class='line-number'><a name='L1155' href='#L1155'><pre>1155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L1156' href='#L1156'><pre>1156</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> Result<T, E>,</span></pre></td></tr><tr><td class='line-number'><a name='L1157' href='#L1157'><pre>1157</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span>{</pre></td></tr><tr><td class='line-number'><a name='L1158' href='#L1158'><pre>1158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Fast path check</pre></td></tr><tr><td class='line-number'><a name='L1159' href='#L1159'><pre>1159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Some(<span class='red'>value</span>) = <span class='red'>self.get()</span> {</pre></td></tr><tr><td class='line-number'><a name='L1160' href='#L1160'><pre>1160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Ok(value)</span>;</pre></td></tr><tr><td class='line-number'><a name='L1161' href='#L1161'><pre>1161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L1162' href='#L1162'><pre>1162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L1163' href='#L1163'><pre>1163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.0.initialize(f)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L1164' href='#L1164'><pre>1164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1165' href='#L1165'><pre>1165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Safe b/c value is initialized.</pre></td></tr><tr><td class='line-number'><a name='L1166' href='#L1166'><pre>1166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> debug_assert!(<span class='red'>self.0.is_initialized()</span>);</pre></td></tr><tr><td class='line-number'><a name='L1167' href='#L1167'><pre>1167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(unsafe { self.get_unchecked() })</span></pre></td></tr><tr><td class='line-number'><a name='L1168' href='#L1168'><pre>1168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB6_8OnceCellNtNtCs5lS3ZDWxZLX_5alloc6string6StringE15get_or_try_initNCINvB2_11get_or_initNCNvB2_10try_insert0E0NtNvMs4_B6_IBC_pE11get_or_init4VoidECsi22ug6Xb94f_13libfuzzer_sys</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvMs4_NtCsaBdG7DIvBl9_9once_cell4syncINtB6_8OnceCellpE15get_or_try_initppEB8_</pre></div></div></td></tr><tr><td class='line-number'><a name='L1169' href='#L1169'><pre>1169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1170' href='#L1170'><pre>1170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Takes the value out of this `OnceCell`, moving it back to an uninitialized state.</pre></td></tr><tr><td class='line-number'><a name='L1171' href='#L1171'><pre>1171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1172' href='#L1172'><pre>1172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Has no effect and returns `None` if the `OnceCell` hasn't been initialized.</pre></td></tr><tr><td class='line-number'><a name='L1173' href='#L1173'><pre>1173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1174' href='#L1174'><pre>1174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Examples</pre></td></tr><tr><td class='line-number'><a name='L1175' href='#L1175'><pre>1175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1176' href='#L1176'><pre>1176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1177' href='#L1177'><pre>1177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L1178' href='#L1178'><pre>1178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1179' href='#L1179'><pre>1179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell: OnceCell<String> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1180' href='#L1180'><pre>1180</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.take(), None);</pre></td></tr><tr><td class='line-number'><a name='L1181' href='#L1181'><pre>1181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1182' href='#L1182'><pre>1182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1183' href='#L1183'><pre>1183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell.set("hello".to_string()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L1184' href='#L1184'><pre>1184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.take(), Some("hello".to_string()));</pre></td></tr><tr><td class='line-number'><a name='L1185' href='#L1185'><pre>1185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.get(), None);</pre></td></tr><tr><td class='line-number'><a name='L1186' href='#L1186'><pre>1186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1187' href='#L1187'><pre>1187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1188' href='#L1188'><pre>1188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This method is allowed to violate the invariant of writing to a `OnceCell`</pre></td></tr><tr><td class='line-number'><a name='L1189' href='#L1189'><pre>1189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// at most once because it requires `&mut` access to `self`. As with all</pre></td></tr><tr><td class='line-number'><a name='L1190' href='#L1190'><pre>1190</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// interior mutability, `&mut` access permits arbitrary modification:</pre></td></tr><tr><td class='line-number'><a name='L1191' href='#L1191'><pre>1191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1192' href='#L1192'><pre>1192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1193' href='#L1193'><pre>1193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L1194' href='#L1194'><pre>1194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1195' href='#L1195'><pre>1195</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut cell: OnceCell<u32> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1196' href='#L1196'><pre>1196</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell.set(92).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L1197' href='#L1197'><pre>1197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1198' href='#L1198'><pre>1198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1199' href='#L1199'><pre>1199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn take(&mut self) -> Option<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L1200' href='#L1200'><pre>1200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> mem::take(self).into_inner()</span></pre></td></tr><tr><td class='line-number'><a name='L1201' href='#L1201'><pre>1201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1202' href='#L1202'><pre>1202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1203' href='#L1203'><pre>1203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Consumes the `OnceCell`, returning the wrapped value. Returns</pre></td></tr><tr><td class='line-number'><a name='L1204' href='#L1204'><pre>1204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// `None` if the cell was empty.</pre></td></tr><tr><td class='line-number'><a name='L1205' href='#L1205'><pre>1205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1206' href='#L1206'><pre>1206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Examples</pre></td></tr><tr><td class='line-number'><a name='L1207' href='#L1207'><pre>1207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1208' href='#L1208'><pre>1208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1209' href='#L1209'><pre>1209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::OnceCell;</pre></td></tr><tr><td class='line-number'><a name='L1210' href='#L1210'><pre>1210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1211' href='#L1211'><pre>1211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell: OnceCell<String> = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1212' href='#L1212'><pre>1212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.into_inner(), None);</pre></td></tr><tr><td class='line-number'><a name='L1213' href='#L1213'><pre>1213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1214' href='#L1214'><pre>1214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let cell = OnceCell::new();</pre></td></tr><tr><td class='line-number'><a name='L1215' href='#L1215'><pre>1215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// cell.set("hello".to_string()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L1216' href='#L1216'><pre>1216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(cell.into_inner(), Some("hello".to_string()));</pre></td></tr><tr><td class='line-number'><a name='L1217' href='#L1217'><pre>1217</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1218' href='#L1218'><pre>1218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L1219' href='#L1219'><pre>1219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn into_inner(self) -> Option<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L1220' href='#L1220'><pre>1220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.0.into_inner()</span></pre></td></tr><tr><td class='line-number'><a name='L1221' href='#L1221'><pre>1221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1222' href='#L1222'><pre>1222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1223' href='#L1223'><pre>1223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1224' href='#L1224'><pre>1224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A value which is initialized on the first access.</pre></td></tr><tr><td class='line-number'><a name='L1225' href='#L1225'><pre>1225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1226' href='#L1226'><pre>1226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This type is thread-safe and can be used in statics.</pre></td></tr><tr><td class='line-number'><a name='L1227' href='#L1227'><pre>1227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1228' href='#L1228'><pre>1228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1229' href='#L1229'><pre>1229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1230' href='#L1230'><pre>1230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1231' href='#L1231'><pre>1231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use std::collections::HashMap;</pre></td></tr><tr><td class='line-number'><a name='L1232' href='#L1232'><pre>1232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1233' href='#L1233'><pre>1233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L1234' href='#L1234'><pre>1234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1235' href='#L1235'><pre>1235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// static HASHMAP: Lazy<HashMap<i32, String>> = Lazy::new(|| {</pre></td></tr><tr><td class='line-number'><a name='L1236' href='#L1236'><pre>1236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// println!("initializing");</pre></td></tr><tr><td class='line-number'><a name='L1237' href='#L1237'><pre>1237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut m = HashMap::new();</pre></td></tr><tr><td class='line-number'><a name='L1238' href='#L1238'><pre>1238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// m.insert(13, "Spica".to_string());</pre></td></tr><tr><td class='line-number'><a name='L1239' href='#L1239'><pre>1239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// m.insert(74, "Hoyten".to_string());</pre></td></tr><tr><td class='line-number'><a name='L1240' href='#L1240'><pre>1240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// m</pre></td></tr><tr><td class='line-number'><a name='L1241' href='#L1241'><pre>1241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// });</pre></td></tr><tr><td class='line-number'><a name='L1242' href='#L1242'><pre>1242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1243' href='#L1243'><pre>1243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// fn main() {</pre></td></tr><tr><td class='line-number'><a name='L1244' href='#L1244'><pre>1244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// println!("ready");</pre></td></tr><tr><td class='line-number'><a name='L1245' href='#L1245'><pre>1245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// std::thread::spawn(|| {</pre></td></tr><tr><td class='line-number'><a name='L1246' href='#L1246'><pre>1246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// println!("{:?}", HASHMAP.get(&13));</pre></td></tr><tr><td class='line-number'><a name='L1247' href='#L1247'><pre>1247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// }).join().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L1248' href='#L1248'><pre>1248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// println!("{:?}", HASHMAP.get(&74));</pre></td></tr><tr><td class='line-number'><a name='L1249' href='#L1249'><pre>1249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1250' href='#L1250'><pre>1250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // Prints:</pre></td></tr><tr><td class='line-number'><a name='L1251' href='#L1251'><pre>1251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // ready</pre></td></tr><tr><td class='line-number'><a name='L1252' href='#L1252'><pre>1252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // initializing</pre></td></tr><tr><td class='line-number'><a name='L1253' href='#L1253'><pre>1253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // Some("Spica")</pre></td></tr><tr><td class='line-number'><a name='L1254' href='#L1254'><pre>1254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // Some("Hoyten")</pre></td></tr><tr><td class='line-number'><a name='L1255' href='#L1255'><pre>1255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// }</pre></td></tr><tr><td class='line-number'><a name='L1256' href='#L1256'><pre>1256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1257' href='#L1257'><pre>1257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub struct Lazy<T, F = fn() -> T> {</pre></td></tr><tr><td class='line-number'><a name='L1258' href='#L1258'><pre>1258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cell: OnceCell<T>,</pre></td></tr><tr><td class='line-number'><a name='L1259' href='#L1259'><pre>1259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> init: Cell<Option<F>>,</pre></td></tr><tr><td class='line-number'><a name='L1260' href='#L1260'><pre>1260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1261' href='#L1261'><pre>1261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1262' href='#L1262'><pre>1262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: fmt::Debug, F> fmt::Debug for Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L1263' href='#L1263'><pre>1263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L1264' href='#L1264'><pre>1264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> f.debug_struct("Lazy").field("cell", &self.cell).field("init", &"..").finish()</span></pre></td></tr><tr><td class='line-number'><a name='L1265' href='#L1265'><pre>1265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1266' href='#L1266'><pre>1266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1267' href='#L1267'><pre>1267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1268' href='#L1268'><pre>1268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // We never create a `&F` from a `&Lazy<T, F>` so it is fine to not impl</pre></td></tr><tr><td class='line-number'><a name='L1269' href='#L1269'><pre>1269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // `Sync` for `F`. We do create a `&mut Option<F>` in `force`, but this is</pre></td></tr><tr><td class='line-number'><a name='L1270' href='#L1270'><pre>1270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // properly synchronized, so it only happens once so it also does not</pre></td></tr><tr><td class='line-number'><a name='L1271' href='#L1271'><pre>1271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // contribute to this impl.</pre></td></tr><tr><td class='line-number'><a name='L1272' href='#L1272'><pre>1272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe impl<T, F: Send> Sync for Lazy<T, F> where OnceCell<T>: Sync {}</pre></td></tr><tr><td class='line-number'><a name='L1273' href='#L1273'><pre>1273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // auto-derived `Send` impl is OK.</pre></td></tr><tr><td class='line-number'><a name='L1274' href='#L1274'><pre>1274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1275' href='#L1275'><pre>1275</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F: RefUnwindSafe> RefUnwindSafe for Lazy<T, F> where OnceCell<T>: RefUnwindSafe {}</pre></td></tr><tr><td class='line-number'><a name='L1276' href='#L1276'><pre>1276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1277' href='#L1277'><pre>1277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F> Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L1278' href='#L1278'><pre>1278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new lazy value with the given initializing</pre></td></tr><tr><td class='line-number'><a name='L1279' href='#L1279'><pre>1279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// function.</pre></td></tr><tr><td class='line-number'><a name='L1280' href='#L1280'><pre>1280</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new(f: F) -> Lazy<T, F> {</span></pre></td></tr><tr><td class='line-number'><a name='L1281' href='#L1281'><pre>1281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Lazy { cell: OnceCell::new(), init: Cell::new(Some(f)) }</span></pre></td></tr><tr><td class='line-number'><a name='L1282' href='#L1282'><pre>1282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1283' href='#L1283'><pre>1283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1284' href='#L1284'><pre>1284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Consumes this `Lazy` returning the stored value.</pre></td></tr><tr><td class='line-number'><a name='L1285' href='#L1285'><pre>1285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1286' href='#L1286'><pre>1286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `Ok(value)` if `Lazy` is initialized and `Err(f)` otherwise.</pre></td></tr><tr><td class='line-number'><a name='L1287' href='#L1287'><pre>1287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn into_value(this: Lazy<T, F>) -> Result<T, F> {</span></pre></td></tr><tr><td class='line-number'><a name='L1288' href='#L1288'><pre>1288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let cell = this.cell;</span></pre></td></tr><tr><td class='line-number'><a name='L1289' href='#L1289'><pre>1289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let init = this.init;</span></pre></td></tr><tr><td class='line-number'><a name='L1290' href='#L1290'><pre>1290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cell.into_inner().ok_or_else(</span>|| <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L1291' href='#L1291'><pre>1291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> init.take().unwrap_or_else(</span>|| <span class='red'>panic!("Lazy instance has previously been poisoned"</span>)<span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L1292' href='#L1292'><pre>1292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L1293' href='#L1293'><pre>1293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1294' href='#L1294'><pre>1294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1295' href='#L1295'><pre>1295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1296' href='#L1296'><pre>1296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F: FnOnce() -> T> Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L1297' href='#L1297'><pre>1297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Forces the evaluation of this lazy value and</pre></td></tr><tr><td class='line-number'><a name='L1298' href='#L1298'><pre>1298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// returns a reference to the result. This is equivalent</pre></td></tr><tr><td class='line-number'><a name='L1299' href='#L1299'><pre>1299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// to the `Deref` impl, but is explicit.</pre></td></tr><tr><td class='line-number'><a name='L1300' href='#L1300'><pre>1300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1301' href='#L1301'><pre>1301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1302' href='#L1302'><pre>1302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1303' href='#L1303'><pre>1303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L1304' href='#L1304'><pre>1304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1305' href='#L1305'><pre>1305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let lazy = Lazy::new(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L1306' href='#L1306'><pre>1306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1307' href='#L1307'><pre>1307</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::force(&lazy), &92);</pre></td></tr><tr><td class='line-number'><a name='L1308' href='#L1308'><pre>1308</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&*lazy, &92);</pre></td></tr><tr><td class='line-number'><a name='L1309' href='#L1309'><pre>1309</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1310' href='#L1310'><pre>1310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn force(this: &Lazy<T, F>) -> &T {</span></pre></td></tr><tr><td class='line-number'><a name='L1311' href='#L1311'><pre>1311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> this.cell.get_or_init(</span>|| <span class='red'>match this.init.take()</span> {</pre></td></tr><tr><td class='line-number'><a name='L1312' href='#L1312'><pre>1312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>f) => f()</span>,</pre></td></tr><tr><td class='line-number'><a name='L1313' href='#L1313'><pre>1313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>panic!("Lazy instance has previously been poisoned")</span>,</pre></td></tr><tr><td class='line-number'><a name='L1314' href='#L1314'><pre>1314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L1315' href='#L1315'><pre>1315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1316' href='#L1316'><pre>1316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1317' href='#L1317'><pre>1317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Forces the evaluation of this lazy value and</pre></td></tr><tr><td class='line-number'><a name='L1318' href='#L1318'><pre>1318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// returns a mutable reference to the result. This is equivalent</pre></td></tr><tr><td class='line-number'><a name='L1319' href='#L1319'><pre>1319</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// to the `Deref` impl, but is explicit.</pre></td></tr><tr><td class='line-number'><a name='L1320' href='#L1320'><pre>1320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1321' href='#L1321'><pre>1321</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1322' href='#L1322'><pre>1322</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1323' href='#L1323'><pre>1323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L1324' href='#L1324'><pre>1324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1325' href='#L1325'><pre>1325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut lazy = Lazy::new(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L1326' href='#L1326'><pre>1326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1327' href='#L1327'><pre>1327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::force_mut(&mut lazy), &mut 92);</pre></td></tr><tr><td class='line-number'><a name='L1328' href='#L1328'><pre>1328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1329' href='#L1329'><pre>1329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn force_mut(this: &mut Lazy<T, F>) -> &mut T {</span></pre></td></tr><tr><td class='line-number'><a name='L1330' href='#L1330'><pre>1330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if this.cell.get_mut().is_none()</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L1331' href='#L1331'><pre>1331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let value</span> = match <span class='red'>this.init.get_mut().take()</span> {</pre></td></tr><tr><td class='line-number'><a name='L1332' href='#L1332'><pre>1332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>f) => f()</span>,</pre></td></tr><tr><td class='line-number'><a name='L1333' href='#L1333'><pre>1333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> None => <span class='red'>panic!("Lazy instance has previously been poisoned")</span>,</pre></td></tr><tr><td class='line-number'><a name='L1334' href='#L1334'><pre>1334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L1335' href='#L1335'><pre>1335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>this.cell = OnceCell::with_value(value)</span>;</pre></td></tr><tr><td class='line-number'><a name='L1336' href='#L1336'><pre>1336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L1337' href='#L1337'><pre>1337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>this.cell.get_mut().unwrap_or_else(</span>|| <span class='red'>unreachable!()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L1338' href='#L1338'><pre>1338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1339' href='#L1339'><pre>1339</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1340' href='#L1340'><pre>1340</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the reference to the result of this lazy value if</pre></td></tr><tr><td class='line-number'><a name='L1341' href='#L1341'><pre>1341</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// it was initialized, otherwise returns `None`.</pre></td></tr><tr><td class='line-number'><a name='L1342' href='#L1342'><pre>1342</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1343' href='#L1343'><pre>1343</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1344' href='#L1344'><pre>1344</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1345' href='#L1345'><pre>1345</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L1346' href='#L1346'><pre>1346</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1347' href='#L1347'><pre>1347</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let lazy = Lazy::new(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L1348' href='#L1348'><pre>1348</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1349' href='#L1349'><pre>1349</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::get(&lazy), None);</pre></td></tr><tr><td class='line-number'><a name='L1350' href='#L1350'><pre>1350</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&*lazy, &92);</pre></td></tr><tr><td class='line-number'><a name='L1351' href='#L1351'><pre>1351</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::get(&lazy), Some(&92));</pre></td></tr><tr><td class='line-number'><a name='L1352' href='#L1352'><pre>1352</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1353' href='#L1353'><pre>1353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get(this: &Lazy<T, F>) -> Option<&T> {</span></pre></td></tr><tr><td class='line-number'><a name='L1354' href='#L1354'><pre>1354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> this.cell.get()</span></pre></td></tr><tr><td class='line-number'><a name='L1355' href='#L1355'><pre>1355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1356' href='#L1356'><pre>1356</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1357' href='#L1357'><pre>1357</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the reference to the result of this lazy value if</pre></td></tr><tr><td class='line-number'><a name='L1358' href='#L1358'><pre>1358</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// it was initialized, otherwise returns `None`.</pre></td></tr><tr><td class='line-number'><a name='L1359' href='#L1359'><pre>1359</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1360' href='#L1360'><pre>1360</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// # Example</pre></td></tr><tr><td class='line-number'><a name='L1361' href='#L1361'><pre>1361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1362' href='#L1362'><pre>1362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::sync::Lazy;</pre></td></tr><tr><td class='line-number'><a name='L1363' href='#L1363'><pre>1363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1364' href='#L1364'><pre>1364</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut lazy = Lazy::new(|| 92);</pre></td></tr><tr><td class='line-number'><a name='L1365' href='#L1365'><pre>1365</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1366' href='#L1366'><pre>1366</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::get_mut(&mut lazy), None);</pre></td></tr><tr><td class='line-number'><a name='L1367' href='#L1367'><pre>1367</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(&*lazy, &92);</pre></td></tr><tr><td class='line-number'><a name='L1368' href='#L1368'><pre>1368</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// assert_eq!(Lazy::get_mut(&mut lazy), Some(&mut 92));</pre></td></tr><tr><td class='line-number'><a name='L1369' href='#L1369'><pre>1369</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1370' href='#L1370'><pre>1370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_mut(this: &mut Lazy<T, F>) -> Option<&mut T> {</span></pre></td></tr><tr><td class='line-number'><a name='L1371' href='#L1371'><pre>1371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> this.cell.get_mut()</span></pre></td></tr><tr><td class='line-number'><a name='L1372' href='#L1372'><pre>1372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1373' href='#L1373'><pre>1373</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1374' href='#L1374'><pre>1374</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1375' href='#L1375'><pre>1375</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F: FnOnce() -> T> Deref for Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L1376' href='#L1376'><pre>1376</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Target = T;</pre></td></tr><tr><td class='line-number'><a name='L1377' href='#L1377'><pre>1377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn deref(&self) -> &T {</span></pre></td></tr><tr><td class='line-number'><a name='L1378' href='#L1378'><pre>1378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Lazy::force(self)</span></pre></td></tr><tr><td class='line-number'><a name='L1379' href='#L1379'><pre>1379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1380' href='#L1380'><pre>1380</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1381' href='#L1381'><pre>1381</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1382' href='#L1382'><pre>1382</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T, F: FnOnce() -> T> DerefMut for Lazy<T, F> {</pre></td></tr><tr><td class='line-number'><a name='L1383' href='#L1383'><pre>1383</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn deref_mut(&mut self) -> &mut T {</span></pre></td></tr><tr><td class='line-number'><a name='L1384' href='#L1384'><pre>1384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Lazy::force_mut(self)</span></pre></td></tr><tr><td class='line-number'><a name='L1385' href='#L1385'><pre>1385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1386' href='#L1386'><pre>1386</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1387' href='#L1387'><pre>1387</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1388' href='#L1388'><pre>1388</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T: Default> Default for Lazy<T> {</pre></td></tr><tr><td class='line-number'><a name='L1389' href='#L1389'><pre>1389</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new lazy value using `Default` as the initializing function.</pre></td></tr><tr><td class='line-number'><a name='L1390' href='#L1390'><pre>1390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn default() -> Lazy<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L1391' href='#L1391'><pre>1391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Lazy::new(T::default)</span></pre></td></tr><tr><td class='line-number'><a name='L1392' href='#L1392'><pre>1392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L1393' href='#L1393'><pre>1393</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L1394' href='#L1394'><pre>1394</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1395' href='#L1395'><pre>1395</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```compile_fail</pre></td></tr><tr><td class='line-number'><a name='L1396' href='#L1396'><pre>1396</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// struct S(*mut ());</pre></td></tr><tr><td class='line-number'><a name='L1397' href='#L1397'><pre>1397</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// unsafe impl Sync for S {}</pre></td></tr><tr><td class='line-number'><a name='L1398' href='#L1398'><pre>1398</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1399' href='#L1399'><pre>1399</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// fn share<T: Sync>(_: &T) {}</pre></td></tr><tr><td class='line-number'><a name='L1400' href='#L1400'><pre>1400</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// share(&once_cell::sync::OnceCell::<S>::new());</pre></td></tr><tr><td class='line-number'><a name='L1401' href='#L1401'><pre>1401</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1402' href='#L1402'><pre>1402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1403' href='#L1403'><pre>1403</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```compile_fail</pre></td></tr><tr><td class='line-number'><a name='L1404' href='#L1404'><pre>1404</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// struct S(*mut ());</pre></td></tr><tr><td class='line-number'><a name='L1405' href='#L1405'><pre>1405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// unsafe impl Sync for S {}</pre></td></tr><tr><td class='line-number'><a name='L1406' href='#L1406'><pre>1406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L1407' href='#L1407'><pre>1407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// fn share<T: Sync>(_: &T) {}</pre></td></tr><tr><td class='line-number'><a name='L1408' href='#L1408'><pre>1408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// share(&once_cell::sync::Lazy::<S>::new(|| unimplemented!()));</pre></td></tr><tr><td class='line-number'><a name='L1409' href='#L1409'><pre>1409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L1410' href='#L1410'><pre>1410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn _dummy() {}</span></pre></td></tr><tr><td class='line-number'><a name='L1411' href='#L1411'><pre>1411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L1412' href='#L1412'><pre>1412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L1413' href='#L1413'><pre>1413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature = "race")]</pre></td></tr><tr><td class='line-number'><a name='L1414' href='#L1414'><pre>1414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod race;</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.18.0/src/race.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L34'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! Thread-safe, non-blocking, "first one wins" flavor of `OnceCell`.</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! If two threads race to initialize a type from the `race` module, they</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! don't block, execute initialization function together, but only one of</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! them stores the result.</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! This module does not require `std` feature.</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! # Atomic orderings</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//!</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! All types in this module use `Acquire` and `Release`</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! [atomic orderings](Ordering) for all their operations. While this is not</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! strictly necessary for types other than `OnceBox`, it is useful for users as</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! it allows them to be certain that after `get` or `get_or_init` returns on</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! one thread, any side-effects caused by the setter thread prior to them</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! calling `set` or `get_or_init` will be made visible to that thread; without</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! it, it's possible for it to appear as if they haven't happened yet from the</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! getter thread's perspective. This is an acceptable tradeoff to make since</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! `Acquire` and `Release` have very little performance overhead on most</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//! architectures versus `Relaxed`.</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature = "critical-section")]</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use atomic_polyfill as atomic;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(not(feature = "critical-section"))]</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::sync::atomic;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use atomic::{AtomicPtr, AtomicUsize, Ordering};</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::cell::UnsafeCell;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::marker::PhantomData;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::num::NonZeroUsize;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::ptr;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A thread-safe cell which can be written to only once.</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Default</span>, <span class='red'>Debug</span>)]</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct OnceNonZeroUsize {</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> inner: AtomicUsize,</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl OnceNonZeroUsize {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new empty cell.</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new() -> OnceNonZeroUsize {</span></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceNonZeroUsize { inner: AtomicUsize::new(0) }</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get(&self) -> Option<NonZeroUsize> {</span></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let val = self.inner.load(Ordering::Acquire);</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NonZeroUsize::new(val)</span></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Sets the contents of this cell to `value`.</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `Ok(())` if the cell was empty and `Err(())` if it was</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// full.</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn set(&self, value: NonZeroUsize) -> Result<(), ()> {</span></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let exchange =</span></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.inner.compare_exchange(0, value.get(), Ordering::AcqRel, Ordering::Acquire);</span></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match exchange</span> {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(_) => <span class='red'>Ok(())</span>,</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Err(_) => <span class='red'>Err(())</span>,</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if the cell was</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// empty.</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If several threads concurrently run `get_or_init`, more than one `f` can</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// be called. However, all threads will return the same value, produced by</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// some `f`.</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_init<F>(&self, f: F) -> NonZeroUsize</span></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> NonZeroUsize,</span></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> enum Void {}</span></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get_or_try_init(</span>|| <span class='red'>Ok::<NonZeroUsize, Void>(f())</span><span class='red'>)</span> {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(<span class='red'>val) => val,</span></pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Err(void) => match void {},</span></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the cell was empty. If the cell was empty and `f` failed, an</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// error is returned.</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If several threads concurrently run `get_or_init`, more than one `f` can</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// be called. However, all threads will return the same value, produced by</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// some `f`.</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_try_init<F, E>(&self, f: F) -> Result<NonZeroUsize, E></span></pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> Result<NonZeroUsize, E>,</span></pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let val = self.inner.load(Ordering::Acquire)</span>;</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>res</span> = match <span class='red'>NonZeroUsize::new(val)</span> {</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Some(<span class='red'>it) => it</span>,</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> None => {</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut val</span> = <span class='red'>f()</span><span class='red'>?</span>.<span class='red'>get();</span></pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let exchange =</span></pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.inner.compare_exchange(0, val, Ordering::AcqRel, Ordering::Acquire)</span>;</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Err(<span class='red'>old</span>) = <span class='red'>exchange</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> val = old;</span></pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> unsafe { <span class='red'>NonZeroUsize::new_unchecked(val)</span> }</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(res)</span></pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A thread-safe cell which can be written to only once.</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Default</span>, <span class='red'>Debug</span>)]</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct OnceBool {</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> inner: OnceNonZeroUsize,</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl OnceBool {</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new empty cell.</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new() -> OnceBool {</span></pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceBool { inner: OnceNonZeroUsize::new() }</span></pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get(&self) -> Option<bool> {</span></pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.inner.get().map(OnceBool::from_usize)</span></pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Sets the contents of this cell to `value`.</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `Ok(())` if the cell was empty and `Err(())` if it was</pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// full.</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn set(&self, value: bool) -> Result<(), ()> {</span></pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.inner.set(OnceBool::to_usize(value))</span></pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if the cell was</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// empty.</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If several threads concurrently run `get_or_init`, more than one `f` can</pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// be called. However, all threads will return the same value, produced by</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// some `f`.</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_init<F>(&self, f: F) -> bool</span></pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> bool,</span></pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceBool::from_usize(self.inner.get_or_init(</span>|| <span class='red'>OnceBool::to_usize(f())</span><span class='red'>))</span></pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the cell was empty. If the cell was empty and `f` failed, an</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// error is returned.</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If several threads concurrently run `get_or_init`, more than one `f` can</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// be called. However, all threads will return the same value, produced by</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// some `f`.</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_try_init<F, E>(&self, f: F) -> Result<bool, E></span></pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> Result<bool, E>,</span></pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.inner.get_or_try_init(</span>|| <span class='red'>f().map(OnceBool::to_usize)</span><span class='red'>).map(OnceBool::from_usize)</span></pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from_usize(value: NonZeroUsize) -> bool {</span></pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> value.get() == 1</span></pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn to_usize(value: bool) -> NonZeroUsize {</span></pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsafe { NonZeroUsize::new_unchecked(if value</span> { <span class='red'>1</span> } else { <span class='red'>2</span> }) }</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A thread-safe cell which can be written to only once.</pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct OnceRef<'a, T> {</pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> inner: AtomicPtr<T>,</pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ghost: PhantomData<UnsafeCell<&'a T>>,</pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// TODO: Replace UnsafeCell with SyncUnsafeCell once stabilized</pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>unsafe impl<'a, T: Sync> Sync for OnceRef<'a, T> {}</pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T> core::fmt::Debug for OnceRef<'a, T> {</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> write!(f, "OnceRef({:?})", self.inner)</span></pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T> Default for OnceRef<'a, T> {</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn default() -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Self::new()</span></pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, T> OnceRef<'a, T> {</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new empty cell.</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new() -> OnceRef<'a, T> {</span></pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceRef { inner: AtomicPtr::new(ptr::null_mut()), ghost: PhantomData }</span></pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets a reference to the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get(&self) -> Option<&'a T> {</span></pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let ptr = self.inner.load(Ordering::Acquire);</span></pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsafe { ptr.as_ref() }</span></pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Sets the contents of this cell to `value`.</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `Ok(())` if the cell was empty and `Err(value)` if it was</pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// full.</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn set(&self, value: &'a T) -> Result<(), ()> {</span></pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let ptr = value as *const T as *mut T;</span></pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let exchange =</span></pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.inner.compare_exchange(ptr::null_mut(), ptr, Ordering::AcqRel, Ordering::Acquire);</span></pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match exchange</span> {</pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(_) => <span class='red'>Ok(())</span>,</pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Err(_) => <span class='red'>Err(())</span>,</pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if the cell was</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// empty.</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If several threads concurrently run `get_or_init`, more than one `f` can</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// be called. However, all threads will return the same value, produced by</pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// some `f`.</pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_init<F>(&self, f: F) -> &'a T</span></pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> &'a T,</span></pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> enum Void {}</span></pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get_or_try_init(</span>|| <span class='red'>Ok::<&'a T, Void>(f())</span><span class='red'>)</span> {</pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(<span class='red'>val) => val,</span></pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Err(void) => match void {},</span></pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if</pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the cell was empty. If the cell was empty and `f` failed, an</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// error is returned.</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If several threads concurrently run `get_or_init`, more than one `f` can</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// be called. However, all threads will return the same value, produced by</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// some `f`.</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&'a T, E></span></pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> Result<&'a T, E>,</span></pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut ptr = self.inner.load(Ordering::Acquire);</span></pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if ptr.is_null()</span> {</pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // TODO replace with `cast_mut` when MSRV reaches 1.65.0 (also in `set`)</pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> ptr = <span class='red'>f()</span><span class='red'>?</span> as *const T as *mut T;</pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>exchange = self.inner.compare_exchange(</span></pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr::null_mut(),</span></pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr,</span></pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::AcqRel,</span></pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::Acquire,</span></pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> )</span>;</pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Err(<span class='red'>old</span>) = <span class='red'>exchange</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr = old;</span></pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(unsafe { &*ptr })</span></pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```compile_fail</pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// use once_cell::race::OnceRef;</pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut l = OnceRef::new();</pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// {</pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let y = 2;</pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// let mut r = OnceRef::new();</pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// r.set(&y).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// core::mem::swap(&mut l, &mut r);</pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// }</pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// // l now contains a dangling reference to y</pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// eprintln!("uaf: {}", l.get().unwrap());</pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn _dummy() {}</span></pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature = "alloc")]</pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use self::once_box::OnceBox;</pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature = "alloc")]</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod once_box {</pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::atomic::{AtomicPtr, Ordering};</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use core::{marker::PhantomData, ptr};</pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use alloc::boxed::Box;</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A thread-safe cell which can be written to only once.</pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub struct OnceBox<T> {</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> inner: AtomicPtr<T>,</pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ghost: PhantomData<Option<Box<T>>>,</pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L305' href='#L305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L306' href='#L306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> core::fmt::Debug for OnceBox<T> {</pre></td></tr><tr><td class='line-number'><a name='L307' href='#L307'><pre>307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L308' href='#L308'><pre>308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> write!(f, "OnceBox({:?})", self.inner.load(Ordering::Relaxed))</span></pre></td></tr><tr><td class='line-number'><a name='L309' href='#L309'><pre>309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L310' href='#L310'><pre>310</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L311' href='#L311'><pre>311</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L312' href='#L312'><pre>312</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> Default for OnceBox<T> {</pre></td></tr><tr><td class='line-number'><a name='L313' href='#L313'><pre>313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn default() -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L314' href='#L314'><pre>314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Self::new()</span></pre></td></tr><tr><td class='line-number'><a name='L315' href='#L315'><pre>315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L316' href='#L316'><pre>316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L317' href='#L317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L318' href='#L318'><pre>318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> Drop for OnceBox<T> {</pre></td></tr><tr><td class='line-number'><a name='L319' href='#L319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn drop(&mut self) {</span></pre></td></tr><tr><td class='line-number'><a name='L320' href='#L320'><pre>320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let ptr = *self.inner.get_mut();</span></pre></td></tr><tr><td class='line-number'><a name='L321' href='#L321'><pre>321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if !ptr.is_null()</span> {</pre></td></tr><tr><td class='line-number'><a name='L322' href='#L322'><pre>322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>drop(unsafe { Box::from_raw(ptr) })</span></pre></td></tr><tr><td class='line-number'><a name='L323' href='#L323'><pre>323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L324' href='#L324'><pre>324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L325' href='#L325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L326' href='#L326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L327' href='#L327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<T> OnceBox<T> {</pre></td></tr><tr><td class='line-number'><a name='L328' href='#L328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Creates a new empty cell.</pre></td></tr><tr><td class='line-number'><a name='L329' href='#L329'><pre>329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const fn new() -> OnceBox<T> {</span></pre></td></tr><tr><td class='line-number'><a name='L330' href='#L330'><pre>330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OnceBox { inner: AtomicPtr::new(ptr::null_mut()), ghost: PhantomData }</span></pre></td></tr><tr><td class='line-number'><a name='L331' href='#L331'><pre>331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L332' href='#L332'><pre>332</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L333' href='#L333'><pre>333</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets a reference to the underlying value.</pre></td></tr><tr><td class='line-number'><a name='L334' href='#L334'><pre>334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get(&self) -> Option<&T> {</span></pre></td></tr><tr><td class='line-number'><a name='L335' href='#L335'><pre>335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let ptr = self.inner.load(Ordering::Acquire);</span></pre></td></tr><tr><td class='line-number'><a name='L336' href='#L336'><pre>336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if ptr.is_null()</span> {</pre></td></tr><tr><td class='line-number'><a name='L337' href='#L337'><pre>337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>None</span>;</pre></td></tr><tr><td class='line-number'><a name='L338' href='#L338'><pre>338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L339' href='#L339'><pre>339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Some(unsafe { &*ptr })</span></pre></td></tr><tr><td class='line-number'><a name='L340' href='#L340'><pre>340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L341' href='#L341'><pre>341</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L342' href='#L342'><pre>342</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Sets the contents of this cell to `value`.</pre></td></tr><tr><td class='line-number'><a name='L343' href='#L343'><pre>343</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L344' href='#L344'><pre>344</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Returns `Ok(())` if the cell was empty and `Err(value)` if it was</pre></td></tr><tr><td class='line-number'><a name='L345' href='#L345'><pre>345</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// full.</pre></td></tr><tr><td class='line-number'><a name='L346' href='#L346'><pre>346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn set(&self, value: Box<T>) -> Result<(), Box<T>> {</span></pre></td></tr><tr><td class='line-number'><a name='L347' href='#L347'><pre>347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let ptr = Box::into_raw(value);</span></pre></td></tr><tr><td class='line-number'><a name='L348' href='#L348'><pre>348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let exchange = self.inner.compare_exchange(</span></pre></td></tr><tr><td class='line-number'><a name='L349' href='#L349'><pre>349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr::null_mut(),</span></pre></td></tr><tr><td class='line-number'><a name='L350' href='#L350'><pre>350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr,</span></pre></td></tr><tr><td class='line-number'><a name='L351' href='#L351'><pre>351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::AcqRel,</span></pre></td></tr><tr><td class='line-number'><a name='L352' href='#L352'><pre>352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::Acquire,</span></pre></td></tr><tr><td class='line-number'><a name='L353' href='#L353'><pre>353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> );</span></pre></td></tr><tr><td class='line-number'><a name='L354' href='#L354'><pre>354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if exchange.is_err()</span> {</pre></td></tr><tr><td class='line-number'><a name='L355' href='#L355'><pre>355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>value = unsafe { Box::from_raw(ptr) };</span></pre></td></tr><tr><td class='line-number'><a name='L356' href='#L356'><pre>356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Err(value)</span>;</pre></td></tr><tr><td class='line-number'><a name='L357' href='#L357'><pre>357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L358' href='#L358'><pre>358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L359' href='#L359'><pre>359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L360' href='#L360'><pre>360</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L361' href='#L361'><pre>361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if the cell was</pre></td></tr><tr><td class='line-number'><a name='L362' href='#L362'><pre>362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// empty.</pre></td></tr><tr><td class='line-number'><a name='L363' href='#L363'><pre>363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L364' href='#L364'><pre>364</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If several threads concurrently run `get_or_init`, more than one `f` can</pre></td></tr><tr><td class='line-number'><a name='L365' href='#L365'><pre>365</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// be called. However, all threads will return the same value, produced by</pre></td></tr><tr><td class='line-number'><a name='L366' href='#L366'><pre>366</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// some `f`.</pre></td></tr><tr><td class='line-number'><a name='L367' href='#L367'><pre>367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_init<F>(&self, f: F) -> &T</span></pre></td></tr><tr><td class='line-number'><a name='L368' href='#L368'><pre>368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L369' href='#L369'><pre>369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> Box<T>,</span></pre></td></tr><tr><td class='line-number'><a name='L370' href='#L370'><pre>370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L371' href='#L371'><pre>371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> enum Void {}</span></pre></td></tr><tr><td class='line-number'><a name='L372' href='#L372'><pre>372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self.get_or_try_init(</span>|| <span class='red'>Ok::<Box<T>, Void>(f())</span><span class='red'>)</span> {</pre></td></tr><tr><td class='line-number'><a name='L373' href='#L373'><pre>373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Ok(<span class='red'>val) => val,</span></pre></td></tr><tr><td class='line-number'><a name='L374' href='#L374'><pre>374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Err(void) => match void {},</span></pre></td></tr><tr><td class='line-number'><a name='L375' href='#L375'><pre>375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L376' href='#L376'><pre>376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L377' href='#L377'><pre>377</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L378' href='#L378'><pre>378</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Gets the contents of the cell, initializing it with `f` if</pre></td></tr><tr><td class='line-number'><a name='L379' href='#L379'><pre>379</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the cell was empty. If the cell was empty and `f` failed, an</pre></td></tr><tr><td class='line-number'><a name='L380' href='#L380'><pre>380</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// error is returned.</pre></td></tr><tr><td class='line-number'><a name='L381' href='#L381'><pre>381</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L382' href='#L382'><pre>382</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// If several threads concurrently run `get_or_init`, more than one `f` can</pre></td></tr><tr><td class='line-number'><a name='L383' href='#L383'><pre>383</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// be called. However, all threads will return the same value, produced by</pre></td></tr><tr><td class='line-number'><a name='L384' href='#L384'><pre>384</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// some `f`.</pre></td></tr><tr><td class='line-number'><a name='L385' href='#L385'><pre>385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E></span></pre></td></tr><tr><td class='line-number'><a name='L386' href='#L386'><pre>386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> where</span></pre></td></tr><tr><td class='line-number'><a name='L387' href='#L387'><pre>387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> F: FnOnce() -> Result<Box<T>, E>,</span></pre></td></tr><tr><td class='line-number'><a name='L388' href='#L388'><pre>388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L389' href='#L389'><pre>389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut ptr = self.inner.load(Ordering::Acquire);</span></pre></td></tr><tr><td class='line-number'><a name='L390' href='#L390'><pre>390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L391' href='#L391'><pre>391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if ptr.is_null()</span> {</pre></td></tr><tr><td class='line-number'><a name='L392' href='#L392'><pre>392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>val</span> = <span class='red'>f()</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L393' href='#L393'><pre>393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>ptr = Box::into_raw(val);</span></pre></td></tr><tr><td class='line-number'><a name='L394' href='#L394'><pre>394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let exchange = self.inner.compare_exchange(</span></pre></td></tr><tr><td class='line-number'><a name='L395' href='#L395'><pre>395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr::null_mut(),</span></pre></td></tr><tr><td class='line-number'><a name='L396' href='#L396'><pre>396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr,</span></pre></td></tr><tr><td class='line-number'><a name='L397' href='#L397'><pre>397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::AcqRel,</span></pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ordering::Acquire,</span></pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> )</span>;</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Err(<span class='red'>old</span>) = <span class='red'>exchange</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L401' href='#L401'><pre>401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> drop(unsafe { Box::from_raw(ptr) });</span></pre></td></tr><tr><td class='line-number'><a name='L402' href='#L402'><pre>402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr = old;</span></pre></td></tr><tr><td class='line-number'><a name='L403' href='#L403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L404' href='#L404'><pre>404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L405' href='#L405'><pre>405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(unsafe { &*ptr })</span></pre></td></tr><tr><td class='line-number'><a name='L406' href='#L406'><pre>406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L407' href='#L407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L408' href='#L408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L409' href='#L409'><pre>409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe impl<T: Sync + Send> Sync for OnceBox<T> {}</pre></td></tr><tr><td class='line-number'><a name='L410' href='#L410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L411' href='#L411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```compile_fail</pre></td></tr><tr><td class='line-number'><a name='L412' href='#L412'><pre>412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// struct S(*mut ());</pre></td></tr><tr><td class='line-number'><a name='L413' href='#L413'><pre>413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// unsafe impl Sync for S {}</pre></td></tr><tr><td class='line-number'><a name='L414' href='#L414'><pre>414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L415' href='#L415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// fn share<T: Sync>(_: &T) {}</pre></td></tr><tr><td class='line-number'><a name='L416' href='#L416'><pre>416</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// share(&once_cell::race::OnceBox::<S>::new());</pre></td></tr><tr><td class='line-number'><a name='L417' href='#L417'><pre>417</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// ```</pre></td></tr><tr><td class='line-number'><a name='L418' href='#L418'><pre>418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn _dummy() {}</span></pre></td></tr><tr><td class='line-number'><a name='L419' href='#L419'><pre>419</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/additional.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L30'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::answer::DnsAClass;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::question::DnsQType;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{DnsAType, RData};</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsAdditionals<</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> {</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message: DnsMessage<PTR_STORAGE, { DnsSection::Additionals }, B>,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> remaining: usize,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsAdditionals<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn new(message: DnsMessage<PTR_STORAGE, { DnsSection::Additionals }, B>) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let remaining = message.header().unwrap().answer_count() as usize;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Self {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> message,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining,</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns10additionalINtB2_14DnsAdditionalsKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE3newCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn new(message: DnsMessage<PTR_STORAGE, { DnsSection::Additionals }, B>) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let remaining = message.header().unwrap().answer_count() as usize;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Self {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> message,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining,</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns10additionalINtB2_14DnsAdditionalsKppE3newB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn append(&mut self, answer: DnsAdditional<DnsAType>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let (buffer, position) = self.message.buffer_and_position();</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Truncate the buffer to the current position.</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> buffer.truncate(*position)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>answer.write(&mut self.message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Set answer_count in the header to the current answer count + 1.</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>answer_count = self.message.header().unwrap().answer_count();</span></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let answer_count = answer_count + 1 - self.remaining as u16;</span></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_answer_count(answer_count);</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_name_server_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_additional_records_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.remaining = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn iter(&mut self) -> Result<DnsAdditionalsIterator, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let (buffer, position) = self.message.buffer_and_position();</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let buffer = buffer.bytes();</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsAdditionalsIterator {</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> current_position: position,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining: &mut self.remaining,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns10additionalINtB2_14DnsAdditionalsKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE4iterCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn iter(&mut self) -> Result<DnsAdditionalsIterator, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let (buffer, position) = self.message.buffer_and_position();</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let buffer = buffer.bytes();</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsAdditionalsIterator {</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> current_position: position,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining: &mut self.remaining,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns10additionalINtB2_14DnsAdditionalsKppE4iterB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn complete(mut self) -> Result<DnsMessage<PTR_STORAGE, { DnsSection::Additionals }, B>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.remaining != 0 {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>x</span> in <span class='red'>self.iter()</span><span class='red'>?</span> { <span class='red'>x</span><span class='red'>?</span>; }</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsMessage {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer: self.message.buffer,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: self.message.position,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: self.message.ptr_storage,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns10additionalINtB2_14DnsAdditionalsKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE8completeCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn complete(mut self) -> Result<DnsMessage<PTR_STORAGE, { DnsSection::Additionals }, B>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.remaining != 0 {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>x</span> in <span class='red'>self.iter()</span><span class='red'>?</span> { <span class='red'>x</span><span class='red'>?</span>; }</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsMessage {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer: self.message.buffer,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: self.message.position,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: self.message.ptr_storage,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns10additionalINtB2_14DnsAdditionalsKppE8completeB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsAdditionalsIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> current_position: &'a mut usize,</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> remaining: &'a mut usize,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Iterator for DnsAdditionalsIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = Result<DnsAdditional<'a, RData<'a>>, DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> if *self.remaining == 0 {</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let additional = DnsAdditional::parse(</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> self.buffer, self.current_position</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> *self.remaining -= 1;</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> Some(additional)</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs_NtCslLTLXfmDngu_8flex_dns10additionalNtB4_22DnsAdditionalsIteratorNtNtNtNtCs6xNykbTfrCs_4core4iter6traits8iterator8Iterator4nextCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> if *self.remaining == 0 {</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let additional = DnsAdditional::parse(</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> self.buffer, self.current_position</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> *self.remaining -= 1;</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> Some(additional)</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs_NtCslLTLXfmDngu_8flex_dns10additionalNtB4_22DnsAdditionalsIteratorNtNtNtNtCs6xNykbTfrCs_4core4iter6traits8iterator8Iterator4nextB6_</pre></div></div></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsAdditional<'a, D> {</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub rdata: D,</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub cache_flush: bool,</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub aclass: DnsAClass,</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub ttl: u32,</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DnsAdditional<'a, RData<'a>> {</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> pub fn parse(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let name = DnsName::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> let atype_id = u16::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='covered-line'><pre>81</pre></td><td class='code'><pre> let atype = DnsQType::from_id(atype_id);</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='covered-line'><pre>81</pre></td><td class='code'><pre> let cache_flush = atype_id & 0b1000_0000_0000_0000 != 0;</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='covered-line'><pre>81</pre></td><td class='code'><pre> let aclass = DnsAClass::from_id(u16::parse(bytes, i)?);</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='covered-line'><pre>71</pre></td><td class='code'><pre> let ttl = u32::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> let rdata = RData::parse(bytes, i, atype)?;</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> name,</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> rdata,</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> cache_flush,</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> aclass,</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> ttl,</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the name to the buffer using the pointer storage for compression.</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>message.write_name(self.name)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the atype and aclass to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.id().write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut aclass = self.aclass.id();</span></pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.cache_flush</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> aclass |= 0b1000_0000;</span></pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>aclass.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the ttl to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.ttl.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (<span class='red'>self.rdata.byte_len()</span><span class='red'>?</span> as u16).<span class='red'>write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the type specific data to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> pub fn into_parsed(self) -> Result<DnsAdditional<'a, DnsAType<'a>>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> Ok(DnsAdditional {</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> name: self.name,</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> rdata: self.rdata.into_parsed()?,</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> cache_flush: self.cache_flush,</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> aclass: self.aclass,</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> ttl: self.ttl,</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DnsAdditional<'a, DnsAType<'a>> {</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the name to the buffer using the pointer storage for compression.</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.name.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the atype and aclass to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.id().write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut aclass = self.aclass.id();</span></pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.cache_flush</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> aclass |= 0b1000_0000;</span></pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>aclass.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the ttl to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.ttl.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>rdata_len</span> = <span class='red'>self.rdata.byte_len()</span><span class='red'>?</span> as u16;</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>rdata_len.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the type specific data to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/answer.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L29'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::question::DnsQType;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{DnsAType, RData};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsAnswers<</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message: DnsMessage<PTR_STORAGE, { DnsSection::Answers }, B>,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> remaining: usize,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsAnswers<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn new(message: DnsMessage<PTR_STORAGE, { DnsSection::Answers }, B>) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let remaining = message.header().unwrap().answer_count() as usize;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Self {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> message,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns6answerINtB2_10DnsAnswersKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE3newCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn new(message: DnsMessage<PTR_STORAGE, { DnsSection::Answers }, B>) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let remaining = message.header().unwrap().answer_count() as usize;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Self {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> message,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns6answerINtB2_10DnsAnswersKppE3newB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn append(&mut self, answer: DnsAnswer<DnsAType>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let (buffer, position) = self.message.buffer_and_position();</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Truncate the buffer to the current position.</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> buffer.truncate(*position)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>answer.write(&mut self.message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Set answer_count in the header to the current answer count + 1.</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>answer_count = self.message.header().unwrap().answer_count();</span></pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let answer_count = answer_count + 1 - self.remaining as u16;</span></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_answer_count(answer_count);</span></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_name_server_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_additional_records_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.remaining = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn iter(&mut self) -> Result<DnsAnswerIterator, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let (buffer, position) = self.message.buffer_and_position();</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let buffer = buffer.bytes();</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsAnswerIterator {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> current_position: position,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining: &mut self.remaining,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns6answerINtB2_10DnsAnswersKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE4iterCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn iter(&mut self) -> Result<DnsAnswerIterator, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let (buffer, position) = self.message.buffer_and_position();</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let buffer = buffer.bytes();</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsAnswerIterator {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> current_position: position,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining: &mut self.remaining,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns6answerINtB2_10DnsAnswersKppE4iterB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn complete(mut self) -> Result<DnsMessage<PTR_STORAGE, { DnsSection::NameServers }, B>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.remaining != 0 {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>x</span> in <span class='red'>self.iter()</span><span class='red'>?</span> { <span class='red'>x</span><span class='red'>?</span>; }</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsMessage {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer: self.message.buffer,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: self.message.position,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: self.message.ptr_storage,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns6answerINtB2_10DnsAnswersKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE8completeCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn complete(mut self) -> Result<DnsMessage<PTR_STORAGE, { DnsSection::NameServers }, B>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.remaining != 0 {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>x</span> in <span class='red'>self.iter()</span><span class='red'>?</span> { <span class='red'>x</span><span class='red'>?</span>; }</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsMessage {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer: self.message.buffer,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: self.message.position,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: self.message.ptr_storage,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns6answerINtB2_10DnsAnswersKppE8completeB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsAnswerIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> current_position: &'a mut usize,</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> remaining: &'a mut usize,</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Iterator for DnsAnswerIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = Result<DnsAnswer<'a, RData<'a>>, DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> if *self.remaining == 0 {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let answer = DnsAnswer::parse(</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> self.buffer, self.current_position</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> *self.remaining -= 1;</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> Some(answer)</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs_NtCslLTLXfmDngu_8flex_dns6answerNtB4_17DnsAnswerIteratorNtNtNtNtCs6xNykbTfrCs_4core4iter6traits8iterator8Iterator4nextCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> if *self.remaining == 0 {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let answer = DnsAnswer::parse(</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> self.buffer, self.current_position</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> *self.remaining -= 1;</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> Some(answer)</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs_NtCslLTLXfmDngu_8flex_dns6answerNtB4_17DnsAnswerIteratorNtNtNtNtCs6xNykbTfrCs_4core4iter6traits8iterator8Iterator4nextB6_</pre></div></div></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsAnswer<'a, D> {</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub rdata: D,</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub cache_flush: bool,</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub aclass: DnsAClass,</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub ttl: u32,</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DnsAnswer<'a, RData<'a>> {</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> pub fn parse(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let name = DnsName::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='covered-line'><pre>2.81k</pre></td><td class='code'><pre> let atype_id = u16::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='covered-line'><pre>2.64k</pre></td><td class='code'><pre> let atype = DnsQType::from_id(atype_id);</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='covered-line'><pre>2.64k</pre></td><td class='code'><pre> let cache_flush = atype_id & 0b1000_0000_0000_0000 != 0;</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='covered-line'><pre>2.64k</pre></td><td class='code'><pre> let aclass = DnsAClass::from_id(u16::parse(bytes, i)?);</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='covered-line'><pre>2.51k</pre></td><td class='code'><pre> let ttl = u32::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='covered-line'><pre>2.38k</pre></td><td class='code'><pre> let rdata = RData::parse(bytes, i, atype)?;</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> name,</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> rdata,</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> cache_flush,</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> aclass,</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> ttl,</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the name to the buffer using the pointer storage for compression.</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>message.write_name(self.name)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the atype and aclass to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.id().write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut aclass = self.aclass.id();</span></pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.cache_flush</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> aclass |= 0b1000_0000;</span></pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>aclass.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the ttl to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.ttl.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (<span class='red'>self.rdata.byte_len()</span><span class='red'>?</span> as u16).<span class='red'>write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the type specific data to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> pub fn into_parsed(self) -> Result<DnsAnswer<'a, DnsAType<'a>>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> Ok(DnsAnswer {</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> name: self.name,</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> rdata: self.rdata.into_parsed()?,</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='covered-line'><pre>504</pre></td><td class='code'><pre> cache_flush: self.cache_flush,</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='covered-line'><pre>504</pre></td><td class='code'><pre> aclass: self.aclass,</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='covered-line'><pre>504</pre></td><td class='code'><pre> ttl: self.ttl,</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='covered-line'><pre>1.77k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DnsAnswer<'a, DnsAType<'a>> {</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the name to the buffer using the pointer storage for compression.</pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.name.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the atype and aclass to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.id().write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut aclass = self.aclass.id();</span></pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.cache_flush</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> aclass |= 0b1000_0000;</span></pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>aclass.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the ttl to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.ttl.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>rdata_len</span> = <span class='red'>self.rdata.byte_len()</span><span class='red'>?</span> as u16;</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>rdata_len.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the type specific data to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[repr(u16)]</pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsAClass {</pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IN = 1,</pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CS = 2,</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CH = 3,</pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HS = 4,</pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Reserved,</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl DnsAClass {</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='covered-line'><pre>2.75k</pre></td><td class='code'><pre> pub fn from_id(id: u16) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='covered-line'><pre>2.75k</pre></td><td class='code'><pre> match id {</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre> 1..=4 => unsafe { core::mem::transmute(id) },</pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='covered-line'><pre>2.65k</pre></td><td class='code'><pre> _ => DnsAClass::Reserved,</pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='covered-line'><pre>2.75k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn id(&self) -> u16 {</pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> match self {</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAClass::Reserved => panic!("Reserved QClass"),</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> _ => *self as u16,</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<DnsAClass> for u16 {</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn from(q: DnsAClass) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAClass::id(&q)</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<u16> for DnsAClass {</pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn from(n: u16) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAClass::from_id(n)</pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/characters.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L5'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::fmt::Display;</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsError, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::ParseBytes;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Characters<'a> {</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> bytes: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const MAX_CHARACTER_STRING_LENGTH: usize = 255;</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[macro_export]</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>macro_rules! dns_characters {</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ($value:expr $(,)?) => {</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const CHARACTERS: [u8; $value.len() + 1] = {</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut result = [0; $value.len() + 1];</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut index = 0;</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> loop {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if index == $value.len() {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[0] = index as u8;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[index + 1] = $value[index];</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> index += 1;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe { flex_dns::characters::Characters::new_unchecked(&CHARACTERS) }</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseBytes<'a> for Characters<'a> {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>770</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>770</pre></td><td class='code'><pre> let length = u8::parse_bytes(bytes, i)? as usize;</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>726</pre></td><td class='code'><pre> if length > MAX_CHARACTER_STRING_LENGTH {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(DnsMessageError::DnsError(DnsError::CharacterStringTooLong))</span>;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>726</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>726</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>726</pre></td><td class='code'><pre> if *i + length > bytes.len() {</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>249</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre> let bytes = &bytes[*i..*i + length];</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre> *i += length;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre> Ok(Characters { bytes })</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>770</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Characters<'a> {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> pub const fn new(bytes: &'a [u8]) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> if bytes.len() > MAX_CHARACTER_STRING_LENGTH {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(DnsMessageError::DnsError(DnsError::CharacterStringTooLong))</span>;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Ok(Characters { bytes })</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const unsafe fn new_unchecked(bytes: &'a [u8]) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Characters { bytes }</span></pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn write<</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>message.write_bytes(&[self.bytes.len() as u8])</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>message.write_bytes(self.bytes)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(1 + self.bytes.len())</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> AsRef<[u8]> for Characters<'a> {</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn as_ref(&self) -> &[u8] {</span></pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.bytes</span></pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> From<&'a [u8]> for Characters<'a> {</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(bytes: &'a [u8]) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Characters { bytes }</span></pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> From<Characters<'a>> for &'a [u8] {</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(characters: Characters<'a>) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> characters.bytes</span></pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Display for Characters<'a> {</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result </span>{</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>byte</span> in <span class='red'>self.bytes</span> {</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>write!(f, "\\x{:02x}", byte)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/header.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L2'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A DNS header.</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>)]</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[repr(C)]</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsHeader {</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> id: [u8; 2],</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: [u8; 2],</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> question_count: [u8; 2],</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> answer_count: [u8; 2],</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name_server_count: [u8; 2],</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> additional_records_count: [u8; 2],</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl DnsHeader {</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn from_bytes_mut(bytes: &mut [u8]) -> &mut Self {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe { &mut *(bytes.as_mut_ptr() as *mut Self) }</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> pub fn from_bytes(bytes: &[u8]) -> &Self {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> unsafe { & *(bytes.as_ptr() as *const Self) }</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn id(&self) -> u16 {</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> u16::from_be_bytes(self.id)</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn kind(&self) -> DnsHeaderKind {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if (self.flags[0] & 0b10000000) == 0 {</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>883</pre></td><td class='code'><pre> DnsHeaderKind::Query</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>245</pre></td><td class='code'><pre> DnsHeaderKind::Response</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn opcode(&self) -> DnsHeaderOpcode {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (self.flags[0] & 0b01111000).into()</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn authoritative_answer(&self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (self.flags[0] & 0b00000100) != 0</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn truncated(&self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (self.flags[0] & 0b00000010) != 0</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn recursion_desired(&self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (self.flags[0] & 0b00000001) != 0</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn recursion_available(&self) -> bool {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (self.flags[1] & 0b10000000) != 0</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn response_code(&self) -> DnsHeaderResponseCode {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (self.flags[1] & 0b00001111).into()</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn question_count(&self) -> u16 {</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> u16::from_be_bytes(self.question_count)</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> pub fn answer_count(&self) -> u16 {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> u16::from_be_bytes(self.answer_count)</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn name_server_count(&self) -> u16 {</span></pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> u16::from_be_bytes(self.name_server_count)</span></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn additional_records_count(&self) -> u16 {</span></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> u16::from_be_bytes(self.additional_records_count)</span></pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn set_id(&mut self, id: u16) {</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.id = id.to_be_bytes();</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn set_kind(&mut self, kind: DnsHeaderKind) {</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> match kind {</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsHeaderKind::Query => self.flags[0] &= 0b01111111,</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsHeaderKind::Response => self.flags[0] |= 0b10000000,</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn set_opcode(&mut self, opcode: DnsHeaderOpcode) {</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[0] &= 0b10000111;</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[0] |= (u8::from(opcode) & 0b0000_1111) << 3;</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn set_authoritative_answer(&mut self, authoritative_answer: bool) {</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if authoritative_answer {</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[0] |= 0b00000100;</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[0] &= 0b11111011;</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn set_truncated(&mut self, truncated: bool) {</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if truncated {</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[0] |= 0b00000010;</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[0] &= 0b11111101;</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn set_recursion_desired(&mut self, recursion_desired: bool) {</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if recursion_desired {</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[0] |= 0b00000001;</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[0] &= 0b11111110;</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn set_recursion_available(&mut self, recursion_available: bool) {</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if recursion_available {</pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[1] |= 0b10000000;</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[1] &= 0b01111111;</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn set_response_code(&mut self, response_code: DnsHeaderResponseCode) {</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[1] &= 0b11110000;</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.flags[1] |= u8::from(response_code) & 0b00001111;</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn set_question_count(&mut self, question_count: u16) {</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.question_count = question_count.to_be_bytes();</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn set_answer_count(&mut self, answer_count: u16) {</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.answer_count = answer_count.to_be_bytes();</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn set_name_server_count(&mut self, name_server_count: u16) {</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.name_server_count = name_server_count.to_be_bytes();</pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn set_additional_records_count(&mut self, additional_records_count: u16) {</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.additional_records_count = additional_records_count.to_be_bytes();</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl core::fmt::Debug for DnsHeader {</pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> f.debug_struct("Header")</span></pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("id", &self.id())</span></pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("kind", &self.kind())</span></pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("opcode", &self.opcode())</span></pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("authoritative_answer", &self.authoritative_answer())</span></pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("truncated", &self.truncated())</span></pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("recursion_desired", &self.recursion_desired())</span></pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("recursion_available", &self.recursion_available())</span></pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("response_code", &self.response_code())</span></pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("question_count", &self.question_count())</span></pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("answer_count", &self.answer_count())</span></pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("name_server_count", &self.name_server_count())</span></pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .field("additional_records_count", &self.additional_records_count())</span></pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> .finish()</span></pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The kind of a DNS header.</pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsHeaderKind {</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Query,</pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Response,</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A DNS opcode.</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsHeaderOpcode {</pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Query,</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InverseQuery,</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Status,</pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Notify,</pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Update,</pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Reserved(u8),</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<u8> for DnsHeaderOpcode {</pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn from(value: u8) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> match value {</pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='covered-line'><pre>535</pre></td><td class='code'><pre> 0 => DnsHeaderOpcode::Query,</pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 1 => <span class='red'>DnsHeaderOpcode::InverseQuery</span>,</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 2 => <span class='red'>DnsHeaderOpcode::Status</span>,</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 4 => <span class='red'>DnsHeaderOpcode::Notify</span>,</pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 5 => <span class='red'>DnsHeaderOpcode::Update</span>,</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='covered-line'><pre>593</pre></td><td class='code'><pre> _ => DnsHeaderOpcode::Reserved(value),</pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<DnsHeaderOpcode> for u8 {</pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(value: DnsHeaderOpcode) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match value</span> {</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderOpcode::Query => <span class='red'>0</span>,</pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderOpcode::InverseQuery => <span class='red'>1</span>,</pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderOpcode::Status => <span class='red'>2</span>,</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderOpcode::Notify => <span class='red'>4</span>,</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderOpcode::Update => <span class='red'>5</span>,</pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderOpcode::Reserved(<span class='red'>value) => value</span>,</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A DNS response code.</pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsHeaderResponseCode {</pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NoError,</pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FormatError,</pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ServerFailure,</pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NonExistentDomain,</pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NotImplemented,</pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Refused,</pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ExistentDomain,</pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ExistentRrSet,</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NonExistentRrSet,</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NotAuthoritative,</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NotZone,</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BadOptVersionOrBadSignature,</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BadKey,</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BadTime,</pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BadMode,</pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BadName,</pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BadAlg,</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Reserved(u8),</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<DnsHeaderResponseCode> for u8 {</pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(r: DnsHeaderResponseCode) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match r</span> {</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::NoError => <span class='red'>0</span>,</pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::FormatError => <span class='red'>1</span>,</pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::ServerFailure => <span class='red'>2</span>,</pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::NonExistentDomain => <span class='red'>3</span>,</pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::NotImplemented => <span class='red'>4</span>,</pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::Refused => <span class='red'>5</span>,</pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::ExistentDomain => <span class='red'>6</span>,</pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::ExistentRrSet => <span class='red'>7</span>,</pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::NonExistentRrSet => <span class='red'>8</span>,</pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::NotAuthoritative => <span class='red'>9</span>,</pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::NotZone => <span class='red'>10</span>,</pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::BadOptVersionOrBadSignature => <span class='red'>16</span>,</pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::BadKey => <span class='red'>17</span>,</pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::BadTime => <span class='red'>18</span>,</pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::BadMode => <span class='red'>19</span>,</pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::BadName => <span class='red'>20</span>,</pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::BadAlg => <span class='red'>21</span>,</pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsHeaderResponseCode::Reserved(<span class='red'>n) => n</span>,</pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<u8> for DnsHeaderResponseCode {</pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> fn from(n: u8) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> match n {</pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='covered-line'><pre>643</pre></td><td class='code'><pre> 0 => DnsHeaderResponseCode::NoError,</pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='covered-line'><pre>89</pre></td><td class='code'><pre> 1 => DnsHeaderResponseCode::FormatError,</pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> 2 => DnsHeaderResponseCode::ServerFailure,</pre></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> 3 => DnsHeaderResponseCode::NonExistentDomain,</pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> 4 => DnsHeaderResponseCode::NotImplemented,</pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> 5 => DnsHeaderResponseCode::Refused,</pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> 6 => DnsHeaderResponseCode::ExistentDomain,</pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> 7 => DnsHeaderResponseCode::ExistentRrSet,</pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> 8 => DnsHeaderResponseCode::NonExistentRrSet,</pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> 9 => DnsHeaderResponseCode::NotAuthoritative,</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='covered-line'><pre>40</pre></td><td class='code'><pre> 10 => DnsHeaderResponseCode::NotZone,</pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 16 => <span class='red'>DnsHeaderResponseCode::BadOptVersionOrBadSignature</span>,</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 17 => <span class='red'>DnsHeaderResponseCode::BadKey</span>,</pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 18 => <span class='red'>DnsHeaderResponseCode::BadTime</span>,</pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 19 => <span class='red'>DnsHeaderResponseCode::BadMode</span>,</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 20 => <span class='red'>DnsHeaderResponseCode::BadName</span>,</pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> 21 => <span class='red'>DnsHeaderResponseCode::BadAlg</span>,</pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='covered-line'><pre>258</pre></td><td class='code'><pre> n => DnsHeaderResponseCode::Reserved(n),</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/lib.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L30'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#![feature(ip_in_core)]</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#![feature(adt_const_params)]</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#![feature(generic_const_exprs)]</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#![no_std]</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>extern crate alloc;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::marker::ConstParamTy;</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::additional::DnsAdditionals;</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::answer::DnsAnswers;</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::header::DnsHeader;</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name_servers::DnsNameServers;</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::question::DnsQuestions;</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod header;</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod name;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod characters;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod question;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod name_servers;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod additional;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod answer;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub mod rdata;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod parse;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod write;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsMessageError {</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsError(DnsError),</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BufferError(BufferError),</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<DnsError> for DnsMessageError {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(e: DnsError) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DnsMessageError::DnsError(e)</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<BufferError> for DnsMessageError {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn from(e: BufferError) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DnsMessageError::BufferError(e)</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsError {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> MessageTooShort,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InvalidHeader,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InvalidQuestion,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InvalidAnswer,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InvalidAuthority,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InvalidAdditional,</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> PointerIntoTheFuture,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> PointerCycle,</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NameTooLong,</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> LabelTooLong,</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CharacterStringTooLong,</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> RDataLongerThanMessage,</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> UnexpectedEndOfBuffer,</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InvalidTxtRecord,</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum BufferError {</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> OutOfMemory,</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> LengthOutOfBounds,</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InvalidLength,</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> OffsetOutOfBounds,</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub trait Buffer {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn len(&self) -> usize;</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn truncate(&mut self, new_len: usize) -> Result<(), BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_bytes_at(&mut self, offset: usize, data: &[u8]) -> Result<(), BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_array_at<const BYTES: usize>(&mut self, offset: usize, data: [u8; BYTES]) -> Result<(), BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_at(&mut self, offset: usize, data: u8) -> Result<(), BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_bytes(&mut self, data: &[u8]) -> Result<(), BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_array<const BYTES: usize>(&mut self, data: [u8; BYTES]) -> Result<(), BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write(&mut self, data: u8) -> Result<(), BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn read_bytes_at(&self, offset: usize, length: usize) -> Result<&[u8], BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn read_bytes_at_mut(&mut self, offset: usize, length: usize) -> Result<&mut [u8], BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn read_at(&self, offset: usize) -> Result<u8, BufferError>;</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn bytes(&self) -> &[u8];</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre>fn check_length<const SIZE: usize>(offset: usize, length: usize) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> if offset + length > SIZE {</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>offset > SIZE</span> {</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(BufferError::OffsetOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Err(BufferError::LengthOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre>}</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvCslLTLXfmDngu_8flex_dns12check_lengthKj1000_ECsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre>fn check_length<const SIZE: usize>(offset: usize, length: usize) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> if offset + length > SIZE {</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>offset > SIZE</span> {</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(BufferError::OffsetOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Err(BufferError::LengthOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre>}</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RINvCslLTLXfmDngu_8flex_dns12check_lengthKpEB2_</pre></div></div></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<const SIZE: usize> Buffer for ArrayVec<u8, SIZE> {</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> fn len(&self) -> usize {</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> ArrayVec::len(self)</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_CslLTLXfmDngu_8flex_dnsINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_ENtB5_6Buffer3lenCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> fn len(&self) -> usize {</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> ArrayVec::len(self)</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXINICslLTLXfmDngu_8flex_dnss0_0KpEINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKpENtB5_6Buffer3lenB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn truncate(&mut self, new_len: usize) -> Result<(), BufferError> {</span></pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if new_len > self.len()</span> {</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(BufferError::InvalidLength)</span>;</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ArrayVec::truncate(self, new_len);</span></pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_bytes_at(&mut self, offset: usize, data: &[u8]) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>check_length::<SIZE>(offset, data.len())</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Grow the buffer to the required size</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>unsafe { self.set_len(core::cmp::max(self.len(), offset + data.len())); };</span></pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Copy the data into the buffer</span></pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.as_mut_slice()[offset..offset + data.len()].copy_from_slice(data);</span></pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_array_at<const BYTES: usize>(&mut self, offset: usize, data: [u8; BYTES]) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>check_length::<SIZE>(offset, BYTES)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Grow the buffer to the required size</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>unsafe { self.set_len(core::cmp::max(self.len(), offset + BYTES)); };</span></pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.as_mut_slice()[offset..offset + BYTES].copy_from_slice(&data);</span></pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_at(&mut self, offset: usize, data: u8) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>check_length::<SIZE>(offset, 1)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Grow the buffer to the required size</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>unsafe { self.set_len(core::cmp::max(self.len(), offset + 1)); };</span></pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.as_mut_slice()[offset] = data;</span></pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_bytes(&mut self, data: &[u8]) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> check_length::<SIZE>(self.len(), data.len())<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> self.try_extend_from_slice(data).map_err(|_| <span class='red'>BufferError::OutOfMemory</span>)<span class='red'>?</span>;</pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNCNvXs0_CslLTLXfmDngu_8flex_dnsINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_ENtB7_6Buffer11write_bytes0Csgg978DXfVXR_13fuzz_target_1</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNCNvXINICslLTLXfmDngu_8flex_dnss0_0KpEINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKpENtB7_6Buffer11write_bytes0B7_</pre></div></div></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_CslLTLXfmDngu_8flex_dnsINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_ENtB5_6Buffer11write_bytesCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> check_length::<SIZE>(self.len(), data.len())<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> self.try_extend_from_slice(data).map_err(|_| BufferError::OutOfMemory)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXINICslLTLXfmDngu_8flex_dnss0_0KpEINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKpENtB5_6Buffer11write_bytesB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_array<const BYTES: usize>(&mut self, data: [u8; BYTES]) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>check_length::<SIZE>(self.len(), BYTES)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.try_extend_from_slice(&data).map_err(</span>|_| <span class='red'>BufferError::OutOfMemory</span><span class='red'>)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write(&mut self, data: u8) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>check_length::<SIZE>(self.len(), 1)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.push(data);</span></pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> fn read_bytes_at(&self, offset: usize, length: usize) -> Result<&[u8], BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> if offset + length > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>offset > self.len()</span> {</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(BufferError::OffsetOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Err(BufferError::LengthOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> Ok(&self.as_slice()[offset..offset + length])</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_CslLTLXfmDngu_8flex_dnsINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_ENtB5_6Buffer13read_bytes_atCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> fn read_bytes_at(&self, offset: usize, length: usize) -> Result<&[u8], BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> if offset + length > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>offset > self.len()</span> {</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(BufferError::OffsetOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Err(BufferError::LengthOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> Ok(&self.as_slice()[offset..offset + length])</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXINICslLTLXfmDngu_8flex_dnss0_0KpEINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKpENtB5_6Buffer13read_bytes_atB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn read_bytes_at_mut(&mut self, offset: usize, length: usize) -> Result<&mut [u8], BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>check_length::<SIZE>(offset, length)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>unsafe { self.set_len(core::cmp::max(self.len(), offset + length)); };</span></pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(&mut self.as_mut_slice()[offset..offset + length])</span></pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn read_at(&self, offset: usize) -> Result<u8, BufferError> {</span></pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if offset + 1 > self.len()</span> {</pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>offset > self.len()</span> {</pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(BufferError::OffsetOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Err(BufferError::LengthOutOfBounds)</span>;</pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(self.as_slice()[offset])</span></pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> fn bytes(&self) -> &[u8] {</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> self.as_slice()</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs0_CslLTLXfmDngu_8flex_dnsINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_ENtB5_6Buffer5bytesCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> fn bytes(&self) -> &[u8] {</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> self.as_slice()</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXINICslLTLXfmDngu_8flex_dnss0_0KpEINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKpENtB5_6Buffer5bytesB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(feature = "alloc")]</pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod vec {</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> extern crate alloc;</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::{Buffer, BufferError};</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl Buffer for alloc::vec::Vec<u8> {</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn len(&self) -> usize {</pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> <alloc::vec::Vec<u8>>::len(self)</pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn truncate(&mut self, new_len: usize) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if new_len > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::InvalidLength);</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> <alloc::vec::Vec<u8>>::truncate(self, new_len);</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_bytes_at(&mut self, offset: usize, data: &[u8]) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset + data.len() > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::OffsetOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::LengthOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.as_mut_slice()[offset..offset + data.len()].copy_from_slice(data);</pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_array_at<const BYTES: usize>(&mut self, offset: usize, data: [u8; BYTES]) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset + BYTES > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::OffsetOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::LengthOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.as_mut_slice()[offset..offset + BYTES].copy_from_slice(&data);</pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_at(&mut self, offset: usize, data: u8) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset + 1 > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::OffsetOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::LengthOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.as_mut_slice()[offset] = data;</pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_bytes(&mut self, data: &[u8]) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.extend_from_slice(data);</pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write_array<const BYTES: usize>(&mut self, data: [u8; BYTES]) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.extend_from_slice(&data);</pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write(&mut self, data: u8) -> Result<(), BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.push(data);</pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(())</pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn read_bytes_at(&self, offset: usize, length: usize) -> Result<&[u8], BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset + length > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::OffsetOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::LengthOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(&self.as_slice()[offset..offset + length])</pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn read_bytes_at_mut(&mut self, offset: usize, length: usize) -> Result<&mut [u8], BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L305' href='#L305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset + length > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L306' href='#L306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L307' href='#L307'><pre>307</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::OffsetOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L308' href='#L308'><pre>308</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L309' href='#L309'><pre>309</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::LengthOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L310' href='#L310'><pre>310</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L311' href='#L311'><pre>311</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L312' href='#L312'><pre>312</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(&mut self.as_mut_slice()[offset..offset + length])</pre></td></tr><tr><td class='line-number'><a name='L313' href='#L313'><pre>313</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L314' href='#L314'><pre>314</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L315' href='#L315'><pre>315</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L316' href='#L316'><pre>316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn read_at(&self, offset: usize) -> Result<u8, BufferError> {</pre></td></tr><tr><td class='line-number'><a name='L317' href='#L317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset + 1 > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L318' href='#L318'><pre>318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if offset > self.len() {</pre></td></tr><tr><td class='line-number'><a name='L319' href='#L319'><pre>319</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::OffsetOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L320' href='#L320'><pre>320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L321' href='#L321'><pre>321</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return Err(BufferError::LengthOutOfBounds);</pre></td></tr><tr><td class='line-number'><a name='L322' href='#L322'><pre>322</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L323' href='#L323'><pre>323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L324' href='#L324'><pre>324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.as_slice()[offset])</pre></td></tr><tr><td class='line-number'><a name='L325' href='#L325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L326' href='#L326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L327' href='#L327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L328' href='#L328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn bytes(&self) -> &[u8] {</pre></td></tr><tr><td class='line-number'><a name='L329' href='#L329'><pre>329</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.as_slice()</pre></td></tr><tr><td class='line-number'><a name='L330' href='#L330'><pre>330</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L331' href='#L331'><pre>331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L332' href='#L332'><pre>332</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L333' href='#L333'><pre>333</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L334' href='#L334'><pre>334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L335' href='#L335'><pre>335</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const DNS_HEADER_SIZE: usize = 12;</pre></td></tr><tr><td class='line-number'><a name='L336' href='#L336'><pre>336</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L337' href='#L337'><pre>337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>Ord</span>, <span class='red'>PartialOrd</span>, Eq, <span class='red'>PartialEq</span>, ConstParamTy)]</pre></td></tr><tr><td class='line-number'><a name='L338' href='#L338'><pre>338</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsSection {</pre></td></tr><tr><td class='line-number'><a name='L339' href='#L339'><pre>339</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Questions,</pre></td></tr><tr><td class='line-number'><a name='L340' href='#L340'><pre>340</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Answers,</pre></td></tr><tr><td class='line-number'><a name='L341' href='#L341'><pre>341</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NameServers,</pre></td></tr><tr><td class='line-number'><a name='L342' href='#L342'><pre>342</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Additionals,</pre></td></tr><tr><td class='line-number'><a name='L343' href='#L343'><pre>343</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L344' href='#L344'><pre>344</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L345' href='#L345'><pre>345</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsMessage<</pre></td></tr><tr><td class='line-number'><a name='L346' href='#L346'><pre>346</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L347' href='#L347'><pre>347</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L348' href='#L348'><pre>348</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L349' href='#L349'><pre>349</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> {</pre></td></tr><tr><td class='line-number'><a name='L350' href='#L350'><pre>350</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer: B,</pre></td></tr><tr><td class='line-number'><a name='L351' href='#L351'><pre>351</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> position: usize,</pre></td></tr><tr><td class='line-number'><a name='L352' href='#L352'><pre>352</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Pointers are stored as offsets from the start of the buffer</pre></td></tr><tr><td class='line-number'><a name='L353' href='#L353'><pre>353</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // We dont need this for reading, but we need it for writing compressed pointers</pre></td></tr><tr><td class='line-number'><a name='L354' href='#L354'><pre>354</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ptr_storage: ArrayVec<usize, PTR_STORAGE>,</pre></td></tr><tr><td class='line-number'><a name='L355' href='#L355'><pre>355</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L356' href='#L356'><pre>356</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L357' href='#L357'><pre>357</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>macro_rules! to_section_impl {</pre></td></tr><tr><td class='line-number'><a name='L358' href='#L358'><pre>358</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ($from:expr, $to:expr) => {</pre></td></tr><tr><td class='line-number'><a name='L359' href='#L359'><pre>359</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> impl<</pre></td></tr><tr><td class='line-number'><a name='L360' href='#L360'><pre>360</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L361' href='#L361'><pre>361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L362' href='#L362'><pre>362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> > DnsMessage<PTR_STORAGE, { $from }, B> {</pre></td></tr><tr><td class='line-number'><a name='L363' href='#L363'><pre>363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L364' href='#L364'><pre>364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn next_section(self) -> DnsMessage<PTR_STORAGE, { $to }, B> {</span></pre></td></tr><tr><td class='line-number'><a name='L365' href='#L365'><pre>365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DnsMessage {</span></pre></td></tr><tr><td class='line-number'><a name='L366' href='#L366'><pre>366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> buffer: self.buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L367' href='#L367'><pre>367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> position: self.position,</span></pre></td></tr><tr><td class='line-number'><a name='L368' href='#L368'><pre>368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr_storage: self.ptr_storage,</span></pre></td></tr><tr><td class='line-number'><a name='L369' href='#L369'><pre>369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L370' href='#L370'><pre>370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMsn_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKVNtNtB5_10DnsSection9QuestionsUpE12next_sectionB5_</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMsp_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKVNtNtB5_10DnsSection11NameServersUpE12next_sectionB5_</pre></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMso_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKVNtNtB5_10DnsSection7AnswersUpE12next_sectionB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L371' href='#L371'><pre>371</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L372' href='#L372'><pre>372</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L373' href='#L373'><pre>373</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L374' href='#L374'><pre>374</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L375' href='#L375'><pre>375</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>to_section_impl!(DnsSection::Questions, DnsSection::Answers);</pre></td></tr><tr><td class='line-number'><a name='L376' href='#L376'><pre>376</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>to_section_impl!(DnsSection::Answers, DnsSection::NameServers);</pre></td></tr><tr><td class='line-number'><a name='L377' href='#L377'><pre>377</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>to_section_impl!(DnsSection::NameServers, DnsSection::Additionals);</pre></td></tr><tr><td class='line-number'><a name='L378' href='#L378'><pre>378</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L379' href='#L379'><pre>379</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L380' href='#L380'><pre>380</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L381' href='#L381'><pre>381</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L382' href='#L382'><pre>382</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L383' href='#L383'><pre>383</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsMessage<PTR_STORAGE, SECTION, B> {</pre></td></tr><tr><td class='line-number'><a name='L384' href='#L384'><pre>384</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L385' href='#L385'><pre>385</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn new(mut buffer: B) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L386' href='#L386'><pre>386</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if buffer.len() < DNS_HEADER_SIZE {</pre></td></tr><tr><td class='line-number'><a name='L387' href='#L387'><pre>387</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> buffer.write_bytes(&[0; DNS_HEADER_SIZE])<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L388' href='#L388'><pre>388</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L389' href='#L389'><pre>389</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L390' href='#L390'><pre>390</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L391' href='#L391'><pre>391</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L392' href='#L392'><pre>392</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: DNS_HEADER_SIZE,</pre></td></tr><tr><td class='line-number'><a name='L393' href='#L393'><pre>393</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: ArrayVec::new(),</pre></td></tr><tr><td class='line-number'><a name='L394' href='#L394'><pre>394</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L395' href='#L395'><pre>395</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection9QuestionsUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE3newCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L385' href='#L385'><pre>385</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn new(mut buffer: B) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L386' href='#L386'><pre>386</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if buffer.len() < DNS_HEADER_SIZE {</pre></td></tr><tr><td class='line-number'><a name='L387' href='#L387'><pre>387</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> buffer.write_bytes(&[0; DNS_HEADER_SIZE])<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L388' href='#L388'><pre>388</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L389' href='#L389'><pre>389</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L390' href='#L390'><pre>390</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L391' href='#L391'><pre>391</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L392' href='#L392'><pre>392</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: DNS_HEADER_SIZE,</pre></td></tr><tr><td class='line-number'><a name='L393' href='#L393'><pre>393</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: ArrayVec::new(),</pre></td></tr><tr><td class='line-number'><a name='L394' href='#L394'><pre>394</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L395' href='#L395'><pre>395</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKppE3newB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L396' href='#L396'><pre>396</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L397' href='#L397'><pre>397</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> pub(crate) fn buffer_and_position(&mut self) -> (&mut B, &mut usize) {</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> (&mut self.buffer, &mut self.position)</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='covered-line'><pre>4.51k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection9QuestionsUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE19buffer_and_positionCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn buffer_and_position(&mut self) -> (&mut B, &mut usize) {</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (&mut self.buffer, &mut self.position)</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection11AdditionalsUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE19buffer_and_positionCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn buffer_and_position(&mut self) -> (&mut B, &mut usize) {</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (&mut self.buffer, &mut self.position)</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection7AnswersUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE19buffer_and_positionCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn buffer_and_position(&mut self) -> (&mut B, &mut usize) {</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (&mut self.buffer, &mut self.position)</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection11NameServersUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE19buffer_and_positionCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn buffer_and_position(&mut self) -> (&mut B, &mut usize) {</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> (&mut self.buffer, &mut self.position)</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKppE19buffer_and_positionB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L401' href='#L401'><pre>401</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L402' href='#L402'><pre>402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L403' href='#L403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn reset(self) -> DnsMessage<PTR_STORAGE, { DnsSection::Questions }, B> {</span></pre></td></tr><tr><td class='line-number'><a name='L404' href='#L404'><pre>404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DnsMessage {</span></pre></td></tr><tr><td class='line-number'><a name='L405' href='#L405'><pre>405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> buffer: self.buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L406' href='#L406'><pre>406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> position: 0,</span></pre></td></tr><tr><td class='line-number'><a name='L407' href='#L407'><pre>407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ptr_storage: self.ptr_storage,</span></pre></td></tr><tr><td class='line-number'><a name='L408' href='#L408'><pre>408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L409' href='#L409'><pre>409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L410' href='#L410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L411' href='#L411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L412' href='#L412'><pre>412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn complete(self) -> Result<B, DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L413' href='#L413'><pre>413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(self.buffer)</span></pre></td></tr><tr><td class='line-number'><a name='L414' href='#L414'><pre>414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L415' href='#L415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L416' href='#L416'><pre>416</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L417' href='#L417'><pre>417</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn header_mut(&mut self) -> Result<&mut DnsHeader, DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L418' href='#L418'><pre>418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.position = core::cmp::max(self.position, DNS_HEADER_SIZE);</span></pre></td></tr><tr><td class='line-number'><a name='L419' href='#L419'><pre>419</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(DnsHeader::from_bytes_mut(</span></pre></td></tr><tr><td class='line-number'><a name='L420' href='#L420'><pre>420</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.buffer.read_bytes_at_mut(0, DNS_HEADER_SIZE)</span><span class='red'>?</span></pre></td></tr><tr><td class='line-number'><a name='L421' href='#L421'><pre>421</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ))</pre></td></tr><tr><td class='line-number'><a name='L422' href='#L422'><pre>422</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L423' href='#L423'><pre>423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L424' href='#L424'><pre>424</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> pub fn header(&self) -> Result<&DnsHeader, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> if self.buffer.len() < DNS_HEADER_SIZE {</pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(DnsMessageError::DnsError(DnsError::MessageTooShort))</span>;</pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> Ok(DnsHeader::from_bytes(</pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> self.buffer.read_bytes_at(0, DNS_HEADER_SIZE)<span class='red'>?</span></pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ))</pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection11AdditionalsUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE6headerCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn header(&self) -> Result<&DnsHeader, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.buffer.len() < DNS_HEADER_SIZE {</pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(DnsMessageError::DnsError(DnsError::MessageTooShort))</span>;</pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsHeader::from_bytes(</pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.buffer.read_bytes_at(0, DNS_HEADER_SIZE)<span class='red'>?</span></pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ))</pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection7AnswersUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE6headerCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn header(&self) -> Result<&DnsHeader, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.buffer.len() < DNS_HEADER_SIZE {</pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(DnsMessageError::DnsError(DnsError::MessageTooShort))</span>;</pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsHeader::from_bytes(</pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.buffer.read_bytes_at(0, DNS_HEADER_SIZE)<span class='red'>?</span></pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ))</pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection11NameServersUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE6headerCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn header(&self) -> Result<&DnsHeader, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.buffer.len() < DNS_HEADER_SIZE {</pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(DnsMessageError::DnsError(DnsError::MessageTooShort))</span>;</pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsHeader::from_bytes(</pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> self.buffer.read_bytes_at(0, DNS_HEADER_SIZE)<span class='red'>?</span></pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ))</pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection9QuestionsUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE6headerCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> pub fn header(&self) -> Result<&DnsHeader, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> if self.buffer.len() < DNS_HEADER_SIZE {</pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(DnsMessageError::DnsError(DnsError::MessageTooShort))</span>;</pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> Ok(DnsHeader::from_bytes(</pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> self.buffer.read_bytes_at(0, DNS_HEADER_SIZE)<span class='red'>?</span></pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ))</pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs1_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKppE6headerB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L434' href='#L434'><pre>434</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L435' href='#L435'><pre>435</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L436' href='#L436'><pre>436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn write_bytes(&mut self, bytes: &[u8]) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L437' href='#L437'><pre>437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.position += bytes.len();</span></pre></td></tr><tr><td class='line-number'><a name='L438' href='#L438'><pre>438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L439' href='#L439'><pre>439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(self.buffer.write_bytes(bytes)</span><span class='red'>?</span>)</pre></td></tr><tr><td class='line-number'><a name='L440' href='#L440'><pre>440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L441' href='#L441'><pre>441</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L442' href='#L442'><pre>442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn write_name(</span></pre></td></tr><tr><td class='line-number'><a name='L443' href='#L443'><pre>443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &mut self,</span></pre></td></tr><tr><td class='line-number'><a name='L444' href='#L444'><pre>444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> name: DnsName,</span></pre></td></tr><tr><td class='line-number'><a name='L445' href='#L445'><pre>445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ) -> Result<(), DnsMessageError> </span>{</pre></td></tr><tr><td class='line-number'><a name='L446' href='#L446'><pre>446</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Try to find match</pre></td></tr><tr><td class='line-number'><a name='L447' href='#L447'><pre>447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>idx</span> in <span class='red'>self.ptr_storage.iter().copied()</span> {</pre></td></tr><tr><td class='line-number'><a name='L448' href='#L448'><pre>448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut i = idx</span>;</pre></td></tr><tr><td class='line-number'><a name='L449' href='#L449'><pre>449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>name_at_idx</span> = <span class='red'>DnsName::parse(self.buffer.bytes(), &mut i)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L450' href='#L450'><pre>450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>name_at_idx == name</span> {</pre></td></tr><tr><td class='line-number'><a name='L451' href='#L451'><pre>451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.write_bytes(&(idx as u16 | 0b1100_0000_0000_0000).to_be_bytes())</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L452' href='#L452'><pre>452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Ok(())</span>;</pre></td></tr><tr><td class='line-number'><a name='L453' href='#L453'><pre>453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L454' href='#L454'><pre>454</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L455' href='#L455'><pre>455</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L456' href='#L456'><pre>456</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // No match found, write name</pre></td></tr><tr><td class='line-number'><a name='L457' href='#L457'><pre>457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let (<span class='red'>first, rest</span>) = <span class='red'>name.split_first()</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L458' href='#L458'><pre>458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>original_position = self.position;</span></pre></td></tr><tr><td class='line-number'><a name='L459' href='#L459'><pre>459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.write_bytes(&[first.len() as u8])</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L460' href='#L460'><pre>460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.write_bytes(first)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L461' href='#L461'><pre>461</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L462' href='#L462'><pre>462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Some(<span class='red'>rest</span>) = <span class='red'>rest</span> {</pre></td></tr><tr><td class='line-number'><a name='L463' href='#L463'><pre>463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.write_name(rest)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L464' href='#L464'><pre>464</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L465' href='#L465'><pre>465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.write_bytes(&[0])</span><span class='red'>?</span>; // Null terminator</pre></td></tr><tr><td class='line-number'><a name='L466' href='#L466'><pre>466</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L467' href='#L467'><pre>467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>self.ptr_storage.len() < PTR_STORAGE</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L468' href='#L468'><pre>468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Store pointer for later, if we have space</span></pre></td></tr><tr><td class='line-number'><a name='L469' href='#L469'><pre>469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we dont have space, we just write the name uncompressed</span></pre></td></tr><tr><td class='line-number'><a name='L470' href='#L470'><pre>470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // in the future</span></pre></td></tr><tr><td class='line-number'><a name='L471' href='#L471'><pre>471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.ptr_storage.push(original_position);</span></pre></td></tr><tr><td class='line-number'><a name='L472' href='#L472'><pre>472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L473' href='#L473'><pre>473</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L474' href='#L474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L475' href='#L475'><pre>475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L476' href='#L476'><pre>476</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L477' href='#L477'><pre>477</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L478' href='#L478'><pre>478</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L479' href='#L479'><pre>479</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L480' href='#L480'><pre>480</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L481' href='#L481'><pre>481</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsMessage<PTR_STORAGE, { DnsSection::Questions }, B> {</pre></td></tr><tr><td class='line-number'><a name='L482' href='#L482'><pre>482</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L483' href='#L483'><pre>483</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn questions(self) -> DnsQuestions<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L484' href='#L484'><pre>484</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> DnsQuestions::new(self)</pre></td></tr><tr><td class='line-number'><a name='L485' href='#L485'><pre>485</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs2_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection9QuestionsUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE9questionsCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L483' href='#L483'><pre>483</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn questions(self) -> DnsQuestions<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L484' href='#L484'><pre>484</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> DnsQuestions::new(self)</pre></td></tr><tr><td class='line-number'><a name='L485' href='#L485'><pre>485</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs2_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKVNtNtB5_10DnsSection9QuestionsUpE9questionsB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L486' href='#L486'><pre>486</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L487' href='#L487'><pre>487</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L488' href='#L488'><pre>488</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L489' href='#L489'><pre>489</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L490' href='#L490'><pre>490</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L491' href='#L491'><pre>491</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsMessage<PTR_STORAGE, { DnsSection::Answers }, B> {</pre></td></tr><tr><td class='line-number'><a name='L492' href='#L492'><pre>492</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn answers(self) -> DnsAnswers<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L493' href='#L493'><pre>493</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> DnsAnswers::new(self)</pre></td></tr><tr><td class='line-number'><a name='L494' href='#L494'><pre>494</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs3_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection7AnswersUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE7answersCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L492' href='#L492'><pre>492</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn answers(self) -> DnsAnswers<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L493' href='#L493'><pre>493</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> DnsAnswers::new(self)</pre></td></tr><tr><td class='line-number'><a name='L494' href='#L494'><pre>494</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs3_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKVNtNtB5_10DnsSection7AnswersUpE7answersB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L495' href='#L495'><pre>495</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L496' href='#L496'><pre>496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L497' href='#L497'><pre>497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L498' href='#L498'><pre>498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L499' href='#L499'><pre>499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L500' href='#L500'><pre>500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsMessage<PTR_STORAGE, { DnsSection::NameServers }, B> {</pre></td></tr><tr><td class='line-number'><a name='L501' href='#L501'><pre>501</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn name_servers(self) -> DnsNameServers<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L502' href='#L502'><pre>502</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> DnsNameServers::new(self)</pre></td></tr><tr><td class='line-number'><a name='L503' href='#L503'><pre>503</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs4_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection11NameServersUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE12name_serversCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L501' href='#L501'><pre>501</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn name_servers(self) -> DnsNameServers<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L502' href='#L502'><pre>502</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> DnsNameServers::new(self)</pre></td></tr><tr><td class='line-number'><a name='L503' href='#L503'><pre>503</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs4_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKVNtNtB5_10DnsSection11NameServersUpE12name_serversB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L504' href='#L504'><pre>504</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L505' href='#L505'><pre>505</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L506' href='#L506'><pre>506</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L507' href='#L507'><pre>507</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L508' href='#L508'><pre>508</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L509' href='#L509'><pre>509</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsMessage<PTR_STORAGE, { DnsSection::Additionals }, B> {</pre></td></tr><tr><td class='line-number'><a name='L510' href='#L510'><pre>510</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn additionals(self) -> DnsAdditionals<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L511' href='#L511'><pre>511</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> DnsAdditionals::new(self)</pre></td></tr><tr><td class='line-number'><a name='L512' href='#L512'><pre>512</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMs5_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKj10_KVNtNtB5_10DnsSection11AdditionalsUINtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE11additionalsCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L510' href='#L510'><pre>510</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn additionals(self) -> DnsAdditionals<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L511' href='#L511'><pre>511</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> DnsAdditionals::new(self)</pre></td></tr><tr><td class='line-number'><a name='L512' href='#L512'><pre>512</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMs5_CslLTLXfmDngu_8flex_dnsINtB5_10DnsMessageKpKVNtNtB5_10DnsSection11AdditionalsUpE11additionalsB5_</pre></div></div></td></tr><tr><td class='line-number'><a name='L513' href='#L513'><pre>513</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L514' href='#L514'><pre>514</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L515' href='#L515'><pre>515</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L516' href='#L516'><pre>516</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L517' href='#L517'><pre>517</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L518' href='#L518'><pre>518</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L519' href='#L519'><pre>519</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mod question {</pre></td></tr><tr><td class='line-number'><a name='L520' href='#L520'><pre>520</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::header::{DnsHeaderOpcode, DnsHeaderResponseCode};</pre></td></tr><tr><td class='line-number'><a name='L521' href='#L521'><pre>521</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::question::{DnsQClass, DnsQType, DnsQuestion};</pre></td></tr><tr><td class='line-number'><a name='L522' href='#L522'><pre>522</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L523' href='#L523'><pre>523</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L524' href='#L524'><pre>524</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L525' href='#L525'><pre>525</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn test_question() {</pre></td></tr><tr><td class='line-number'><a name='L526' href='#L526'><pre>526</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer: ArrayVec<u8, 512> = ArrayVec::new();</pre></td></tr><tr><td class='line-number'><a name='L527' href='#L527'><pre>527</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut message: DnsMessage<8, { DnsSection::Questions }, _> = DnsMessage::new(buffer).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L528' href='#L528'><pre>528</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_id(0x1234);</pre></td></tr><tr><td class='line-number'><a name='L529' href='#L529'><pre>529</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_opcode(DnsHeaderOpcode::Query);</pre></td></tr><tr><td class='line-number'><a name='L530' href='#L530'><pre>530</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_authoritative_answer(false);</pre></td></tr><tr><td class='line-number'><a name='L531' href='#L531'><pre>531</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_truncated(false);</pre></td></tr><tr><td class='line-number'><a name='L532' href='#L532'><pre>532</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_recursion_desired(false);</pre></td></tr><tr><td class='line-number'><a name='L533' href='#L533'><pre>533</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_recursion_available(false);</pre></td></tr><tr><td class='line-number'><a name='L534' href='#L534'><pre>534</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_response_code(DnsHeaderResponseCode::NoError);</pre></td></tr><tr><td class='line-number'><a name='L535' href='#L535'><pre>535</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut questions = message.questions();</pre></td></tr><tr><td class='line-number'><a name='L536' href='#L536'><pre>536</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> questions.append(DnsQuestion {</pre></td></tr><tr><td class='line-number'><a name='L537' href='#L537'><pre>537</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap(),</pre></td></tr><tr><td class='line-number'><a name='L538' href='#L538'><pre>538</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qtype: DnsQType::A,</pre></td></tr><tr><td class='line-number'><a name='L539' href='#L539'><pre>539</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qclass: DnsQClass::IN,</pre></td></tr><tr><td class='line-number'><a name='L540' href='#L540'><pre>540</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L541' href='#L541'><pre>541</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message = questions.complete().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L542' href='#L542'><pre>542</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer = message.complete().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L543' href='#L543'><pre>543</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L544' href='#L544'><pre>544</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(buffer.as_slice(), [</pre></td></tr><tr><td class='line-number'><a name='L545' href='#L545'><pre>545</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x12, 0x34, // ID</pre></td></tr><tr><td class='line-number'><a name='L546' href='#L546'><pre>546</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0b0000_0000, 0b0000_0000, // Flags</pre></td></tr><tr><td class='line-number'><a name='L547' href='#L547'><pre>547</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Question count</pre></td></tr><tr><td class='line-number'><a name='L548' href='#L548'><pre>548</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Answer count</pre></td></tr><tr><td class='line-number'><a name='L549' href='#L549'><pre>549</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Authority count</pre></td></tr><tr><td class='line-number'><a name='L550' href='#L550'><pre>550</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Additional count</pre></td></tr><tr><td class='line-number'><a name='L551' href='#L551'><pre>551</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // Name</pre></td></tr><tr><td class='line-number'><a name='L552' href='#L552'><pre>552</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e', // Name</pre></td></tr><tr><td class='line-number'><a name='L553' href='#L553'><pre>553</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm', // Name</pre></td></tr><tr><td class='line-number'><a name='L554' href='#L554'><pre>554</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // Name</pre></td></tr><tr><td class='line-number'><a name='L555' href='#L555'><pre>555</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Type</pre></td></tr><tr><td class='line-number'><a name='L556' href='#L556'><pre>556</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Class</pre></td></tr><tr><td class='line-number'><a name='L557' href='#L557'><pre>557</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ].as_slice());</pre></td></tr><tr><td class='line-number'><a name='L558' href='#L558'><pre>558</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L559' href='#L559'><pre>559</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Decode</pre></td></tr><tr><td class='line-number'><a name='L560' href='#L560'><pre>560</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message: DnsMessage<8, { DnsSection::Questions }, _> = DnsMessage::new(buffer).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L561' href='#L561'><pre>561</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().id(), 0x1234);</pre></td></tr><tr><td class='line-number'><a name='L562' href='#L562'><pre>562</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().opcode(), DnsHeaderOpcode::Query);</pre></td></tr><tr><td class='line-number'><a name='L563' href='#L563'><pre>563</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().authoritative_answer(), false);</pre></td></tr><tr><td class='line-number'><a name='L564' href='#L564'><pre>564</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().truncated(), false);</pre></td></tr><tr><td class='line-number'><a name='L565' href='#L565'><pre>565</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_desired(), false);</pre></td></tr><tr><td class='line-number'><a name='L566' href='#L566'><pre>566</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_available(), false);</pre></td></tr><tr><td class='line-number'><a name='L567' href='#L567'><pre>567</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().response_code(), DnsHeaderResponseCode::NoError);</pre></td></tr><tr><td class='line-number'><a name='L568' href='#L568'><pre>568</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut questions = message.questions();</pre></td></tr><tr><td class='line-number'><a name='L569' href='#L569'><pre>569</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut question_iter = questions.iter().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L570' href='#L570'><pre>570</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let question = question_iter.next().unwrap().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L571' href='#L571'><pre>571</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.name, DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap());</pre></td></tr><tr><td class='line-number'><a name='L572' href='#L572'><pre>572</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qtype, DnsQType::A);</pre></td></tr><tr><td class='line-number'><a name='L573' href='#L573'><pre>573</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qclass, DnsQClass::IN);</pre></td></tr><tr><td class='line-number'><a name='L574' href='#L574'><pre>574</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(question_iter.next().is_none());</pre></td></tr><tr><td class='line-number'><a name='L575' href='#L575'><pre>575</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L576' href='#L576'><pre>576</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L577' href='#L577'><pre>577</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L578' href='#L578'><pre>578</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn query_google_com() {</pre></td></tr><tr><td class='line-number'><a name='L579' href='#L579'><pre>579</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer = ArrayVec::from([</pre></td></tr><tr><td class='line-number'><a name='L580' href='#L580'><pre>580</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x03, // ID</pre></td></tr><tr><td class='line-number'><a name='L581' href='#L581'><pre>581</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x00, // Flags</pre></td></tr><tr><td class='line-number'><a name='L582' href='#L582'><pre>582</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Question count</pre></td></tr><tr><td class='line-number'><a name='L583' href='#L583'><pre>583</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Answer count</pre></td></tr><tr><td class='line-number'><a name='L584' href='#L584'><pre>584</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Authority count</pre></td></tr><tr><td class='line-number'><a name='L585' href='#L585'><pre>585</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Additional count</pre></td></tr><tr><td class='line-number'><a name='L586' href='#L586'><pre>586</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x06, b'g', b'o', b'o', b'g', b'l', b'e', // Name</pre></td></tr><tr><td class='line-number'><a name='L587' href='#L587'><pre>587</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm', // Name</pre></td></tr><tr><td class='line-number'><a name='L588' href='#L588'><pre>588</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // Name</pre></td></tr><tr><td class='line-number'><a name='L589' href='#L589'><pre>589</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Type</pre></td></tr><tr><td class='line-number'><a name='L590' href='#L590'><pre>590</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Class</pre></td></tr><tr><td class='line-number'><a name='L591' href='#L591'><pre>591</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ]);</pre></td></tr><tr><td class='line-number'><a name='L592' href='#L592'><pre>592</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message: DnsMessage<8, { DnsSection::Questions }, _> = DnsMessage::new(buffer).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L593' href='#L593'><pre>593</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().id(), 0x0003);</pre></td></tr><tr><td class='line-number'><a name='L594' href='#L594'><pre>594</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().opcode(), DnsHeaderOpcode::Query);</pre></td></tr><tr><td class='line-number'><a name='L595' href='#L595'><pre>595</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().authoritative_answer(), false);</pre></td></tr><tr><td class='line-number'><a name='L596' href='#L596'><pre>596</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().truncated(), false);</pre></td></tr><tr><td class='line-number'><a name='L597' href='#L597'><pre>597</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_desired(), true);</pre></td></tr><tr><td class='line-number'><a name='L598' href='#L598'><pre>598</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_available(), false);</pre></td></tr><tr><td class='line-number'><a name='L599' href='#L599'><pre>599</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().response_code(), DnsHeaderResponseCode::NoError);</pre></td></tr><tr><td class='line-number'><a name='L600' href='#L600'><pre>600</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut questions = message.questions();</pre></td></tr><tr><td class='line-number'><a name='L601' href='#L601'><pre>601</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut question_iter = questions.iter().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L602' href='#L602'><pre>602</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let question = question_iter.next().unwrap().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L603' href='#L603'><pre>603</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.name, DnsName::from_bytes(b"\x06google\x03com\x00").unwrap());</pre></td></tr><tr><td class='line-number'><a name='L604' href='#L604'><pre>604</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qtype, DnsQType::A);</pre></td></tr><tr><td class='line-number'><a name='L605' href='#L605'><pre>605</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qclass, DnsQClass::IN);</pre></td></tr><tr><td class='line-number'><a name='L606' href='#L606'><pre>606</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(question_iter.next().is_none());</pre></td></tr><tr><td class='line-number'><a name='L607' href='#L607'><pre>607</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L608' href='#L608'><pre>608</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L609' href='#L609'><pre>609</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L610' href='#L610'><pre>610</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn multiple_questions_compression() {</pre></td></tr><tr><td class='line-number'><a name='L611' href='#L611'><pre>611</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer: ArrayVec<u8, 512> = ArrayVec::new();</pre></td></tr><tr><td class='line-number'><a name='L612' href='#L612'><pre>612</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut message: DnsMessage<8, { DnsSection::Questions }, _> = DnsMessage::new(buffer).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L613' href='#L613'><pre>613</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_id(0x1234);</pre></td></tr><tr><td class='line-number'><a name='L614' href='#L614'><pre>614</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_opcode(DnsHeaderOpcode::Query);</pre></td></tr><tr><td class='line-number'><a name='L615' href='#L615'><pre>615</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_authoritative_answer(false);</pre></td></tr><tr><td class='line-number'><a name='L616' href='#L616'><pre>616</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_truncated(false);</pre></td></tr><tr><td class='line-number'><a name='L617' href='#L617'><pre>617</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_recursion_desired(false);</pre></td></tr><tr><td class='line-number'><a name='L618' href='#L618'><pre>618</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_recursion_available(false);</pre></td></tr><tr><td class='line-number'><a name='L619' href='#L619'><pre>619</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_response_code(DnsHeaderResponseCode::NoError);</pre></td></tr><tr><td class='line-number'><a name='L620' href='#L620'><pre>620</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut questions = message.questions();</pre></td></tr><tr><td class='line-number'><a name='L621' href='#L621'><pre>621</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> questions.append(DnsQuestion {</pre></td></tr><tr><td class='line-number'><a name='L622' href='#L622'><pre>622</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap(),</pre></td></tr><tr><td class='line-number'><a name='L623' href='#L623'><pre>623</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qtype: DnsQType::A,</pre></td></tr><tr><td class='line-number'><a name='L624' href='#L624'><pre>624</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qclass: DnsQClass::IN,</pre></td></tr><tr><td class='line-number'><a name='L625' href='#L625'><pre>625</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L626' href='#L626'><pre>626</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> questions.append(DnsQuestion {</pre></td></tr><tr><td class='line-number'><a name='L627' href='#L627'><pre>627</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap(),</pre></td></tr><tr><td class='line-number'><a name='L628' href='#L628'><pre>628</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qtype: DnsQType::AAAA,</pre></td></tr><tr><td class='line-number'><a name='L629' href='#L629'><pre>629</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qclass: DnsQClass::IN,</pre></td></tr><tr><td class='line-number'><a name='L630' href='#L630'><pre>630</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L631' href='#L631'><pre>631</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> questions.append(DnsQuestion {</pre></td></tr><tr><td class='line-number'><a name='L632' href='#L632'><pre>632</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap(),</pre></td></tr><tr><td class='line-number'><a name='L633' href='#L633'><pre>633</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qtype: DnsQType::MX,</pre></td></tr><tr><td class='line-number'><a name='L634' href='#L634'><pre>634</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qclass: DnsQClass::IN,</pre></td></tr><tr><td class='line-number'><a name='L635' href='#L635'><pre>635</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L636' href='#L636'><pre>636</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> questions.append(DnsQuestion {</pre></td></tr><tr><td class='line-number'><a name='L637' href='#L637'><pre>637</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName::from_bytes(b"\x03www\x08examples\x03com\x00").unwrap(),</pre></td></tr><tr><td class='line-number'><a name='L638' href='#L638'><pre>638</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qtype: DnsQType::TXT,</pre></td></tr><tr><td class='line-number'><a name='L639' href='#L639'><pre>639</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qclass: DnsQClass::IN,</pre></td></tr><tr><td class='line-number'><a name='L640' href='#L640'><pre>640</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L641' href='#L641'><pre>641</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> questions.append(DnsQuestion {</pre></td></tr><tr><td class='line-number'><a name='L642' href='#L642'><pre>642</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName::from_bytes(b"\x08examples\x03com\x00").unwrap(),</pre></td></tr><tr><td class='line-number'><a name='L643' href='#L643'><pre>643</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qtype: DnsQType::CERT,</pre></td></tr><tr><td class='line-number'><a name='L644' href='#L644'><pre>644</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qclass: DnsQClass::IN,</pre></td></tr><tr><td class='line-number'><a name='L645' href='#L645'><pre>645</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L646' href='#L646'><pre>646</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message = questions.complete().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L647' href='#L647'><pre>647</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer = message.complete().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L648' href='#L648'><pre>648</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L649' href='#L649'><pre>649</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(</pre></td></tr><tr><td class='line-number'><a name='L650' href='#L650'><pre>650</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer.as_slice(),</pre></td></tr><tr><td class='line-number'><a name='L651' href='#L651'><pre>651</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L652' href='#L652'><pre>652</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x12, 0x34, // ID</pre></td></tr><tr><td class='line-number'><a name='L653' href='#L653'><pre>653</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0b0000_0000, 0b0000_0000, // Flags</pre></td></tr><tr><td class='line-number'><a name='L654' href='#L654'><pre>654</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x05, // Question count</pre></td></tr><tr><td class='line-number'><a name='L655' href='#L655'><pre>655</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Answer count</pre></td></tr><tr><td class='line-number'><a name='L656' href='#L656'><pre>656</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Authority count</pre></td></tr><tr><td class='line-number'><a name='L657' href='#L657'><pre>657</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Additional count</pre></td></tr><tr><td class='line-number'><a name='L658' href='#L658'><pre>658</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // Name</pre></td></tr><tr><td class='line-number'><a name='L659' href='#L659'><pre>659</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e', // Name</pre></td></tr><tr><td class='line-number'><a name='L660' href='#L660'><pre>660</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm', // Name</pre></td></tr><tr><td class='line-number'><a name='L661' href='#L661'><pre>661</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // Name</pre></td></tr><tr><td class='line-number'><a name='L662' href='#L662'><pre>662</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Type</pre></td></tr><tr><td class='line-number'><a name='L663' href='#L663'><pre>663</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Class</pre></td></tr><tr><td class='line-number'><a name='L664' href='#L664'><pre>664</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0xC0, 0x0C, // Name Pointer (0x0C = 12)</pre></td></tr><tr><td class='line-number'><a name='L665' href='#L665'><pre>665</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x1C, // Type</pre></td></tr><tr><td class='line-number'><a name='L666' href='#L666'><pre>666</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Class</pre></td></tr><tr><td class='line-number'><a name='L667' href='#L667'><pre>667</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0xC0, 0x0C, // Name Pointer (0x0C = 12)</pre></td></tr><tr><td class='line-number'><a name='L668' href='#L668'><pre>668</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0F, // Type</pre></td></tr><tr><td class='line-number'><a name='L669' href='#L669'><pre>669</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Class</pre></td></tr><tr><td class='line-number'><a name='L670' href='#L670'><pre>670</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // Name</pre></td></tr><tr><td class='line-number'><a name='L671' href='#L671'><pre>671</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x08, b'e', b'x', b'a', b'm', b'p', b'l', b'e', b's', // Name</pre></td></tr><tr><td class='line-number'><a name='L672' href='#L672'><pre>672</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0xC0, 0x18, // Name Pointer (0x18 = 24)</pre></td></tr><tr><td class='line-number'><a name='L673' href='#L673'><pre>673</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x10, // Type</pre></td></tr><tr><td class='line-number'><a name='L674' href='#L674'><pre>674</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Class</pre></td></tr><tr><td class='line-number'><a name='L675' href='#L675'><pre>675</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0xC0, 0x31, // Name Pointer (0x31 = 48)</pre></td></tr><tr><td class='line-number'><a name='L676' href='#L676'><pre>676</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x25, // Type</pre></td></tr><tr><td class='line-number'><a name='L677' href='#L677'><pre>677</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Class</pre></td></tr><tr><td class='line-number'><a name='L678' href='#L678'><pre>678</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ].as_slice()</pre></td></tr><tr><td class='line-number'><a name='L679' href='#L679'><pre>679</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L680' href='#L680'><pre>680</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L681' href='#L681'><pre>681</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Decode the message again and check that it is the same</pre></td></tr><tr><td class='line-number'><a name='L682' href='#L682'><pre>682</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message: DnsMessage<8, { DnsSection::Questions }, _> = DnsMessage::new(buffer).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L683' href='#L683'><pre>683</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().id(), 0x1234);</pre></td></tr><tr><td class='line-number'><a name='L684' href='#L684'><pre>684</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().opcode(), DnsHeaderOpcode::Query);</pre></td></tr><tr><td class='line-number'><a name='L685' href='#L685'><pre>685</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().authoritative_answer(), false);</pre></td></tr><tr><td class='line-number'><a name='L686' href='#L686'><pre>686</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().truncated(), false);</pre></td></tr><tr><td class='line-number'><a name='L687' href='#L687'><pre>687</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_desired(), false);</pre></td></tr><tr><td class='line-number'><a name='L688' href='#L688'><pre>688</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_available(), false);</pre></td></tr><tr><td class='line-number'><a name='L689' href='#L689'><pre>689</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().response_code(), DnsHeaderResponseCode::NoError);</pre></td></tr><tr><td class='line-number'><a name='L690' href='#L690'><pre>690</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut questions = message.questions();</pre></td></tr><tr><td class='line-number'><a name='L691' href='#L691'><pre>691</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut question_iter = questions.iter().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L692' href='#L692'><pre>692</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let question = question_iter.next().unwrap().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L693' href='#L693'><pre>693</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.name, DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap());</pre></td></tr><tr><td class='line-number'><a name='L694' href='#L694'><pre>694</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qtype, DnsQType::A);</pre></td></tr><tr><td class='line-number'><a name='L695' href='#L695'><pre>695</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qclass, DnsQClass::IN);</pre></td></tr><tr><td class='line-number'><a name='L696' href='#L696'><pre>696</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let question = question_iter.next().unwrap().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L697' href='#L697'><pre>697</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.name, DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap());</pre></td></tr><tr><td class='line-number'><a name='L698' href='#L698'><pre>698</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qtype, DnsQType::AAAA);</pre></td></tr><tr><td class='line-number'><a name='L699' href='#L699'><pre>699</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qclass, DnsQClass::IN);</pre></td></tr><tr><td class='line-number'><a name='L700' href='#L700'><pre>700</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let question = question_iter.next().unwrap().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L701' href='#L701'><pre>701</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.name, DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap());</pre></td></tr><tr><td class='line-number'><a name='L702' href='#L702'><pre>702</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qtype, DnsQType::MX);</pre></td></tr><tr><td class='line-number'><a name='L703' href='#L703'><pre>703</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qclass, DnsQClass::IN);</pre></td></tr><tr><td class='line-number'><a name='L704' href='#L704'><pre>704</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let question = question_iter.next().unwrap().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L705' href='#L705'><pre>705</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.name, DnsName::from_bytes(b"\x03www\x08examples\x03com\x00").unwrap());</pre></td></tr><tr><td class='line-number'><a name='L706' href='#L706'><pre>706</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qtype, DnsQType::TXT);</pre></td></tr><tr><td class='line-number'><a name='L707' href='#L707'><pre>707</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qclass, DnsQClass::IN);</pre></td></tr><tr><td class='line-number'><a name='L708' href='#L708'><pre>708</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let question = question_iter.next().unwrap().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L709' href='#L709'><pre>709</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.name, DnsName::from_bytes(b"\x08examples\x03com\x00").unwrap());</pre></td></tr><tr><td class='line-number'><a name='L710' href='#L710'><pre>710</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qtype, DnsQType::CERT);</pre></td></tr><tr><td class='line-number'><a name='L711' href='#L711'><pre>711</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(question.qclass, DnsQClass::IN);</pre></td></tr><tr><td class='line-number'><a name='L712' href='#L712'><pre>712</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(question_iter.next().is_none());</pre></td></tr><tr><td class='line-number'><a name='L713' href='#L713'><pre>713</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L714' href='#L714'><pre>714</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L715' href='#L715'><pre>715</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L716' href='#L716'><pre>716</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mod answer {</pre></td></tr><tr><td class='line-number'><a name='L717' href='#L717'><pre>717</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use core::net::Ipv4Addr;</pre></td></tr><tr><td class='line-number'><a name='L718' href='#L718'><pre>718</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::answer::{DnsAClass, DnsAnswer};</pre></td></tr><tr><td class='line-number'><a name='L719' href='#L719'><pre>719</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::header::{DnsHeaderOpcode, DnsHeaderResponseCode};</pre></td></tr><tr><td class='line-number'><a name='L720' href='#L720'><pre>720</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::{A, DnsAType};</pre></td></tr><tr><td class='line-number'><a name='L721' href='#L721'><pre>721</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L722' href='#L722'><pre>722</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L723' href='#L723'><pre>723</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L724' href='#L724'><pre>724</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn single_answer() {</pre></td></tr><tr><td class='line-number'><a name='L725' href='#L725'><pre>725</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer: ArrayVec<u8, 512> = ArrayVec::new();</pre></td></tr><tr><td class='line-number'><a name='L726' href='#L726'><pre>726</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut message: DnsMessage<8, { DnsSection::Questions }, _> = DnsMessage::new(buffer).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L727' href='#L727'><pre>727</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_id(0x1234);</pre></td></tr><tr><td class='line-number'><a name='L728' href='#L728'><pre>728</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_opcode(DnsHeaderOpcode::Query);</pre></td></tr><tr><td class='line-number'><a name='L729' href='#L729'><pre>729</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_authoritative_answer(false);</pre></td></tr><tr><td class='line-number'><a name='L730' href='#L730'><pre>730</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_truncated(false);</pre></td></tr><tr><td class='line-number'><a name='L731' href='#L731'><pre>731</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_recursion_desired(false);</pre></td></tr><tr><td class='line-number'><a name='L732' href='#L732'><pre>732</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_recursion_available(false);</pre></td></tr><tr><td class='line-number'><a name='L733' href='#L733'><pre>733</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message.header_mut().unwrap().set_response_code(DnsHeaderResponseCode::NoError);</pre></td></tr><tr><td class='line-number'><a name='L734' href='#L734'><pre>734</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message = message.questions().complete().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L735' href='#L735'><pre>735</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message = {</pre></td></tr><tr><td class='line-number'><a name='L736' href='#L736'><pre>736</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut answers = message.answers();</pre></td></tr><tr><td class='line-number'><a name='L737' href='#L737'><pre>737</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> answers.append(DnsAnswer {</pre></td></tr><tr><td class='line-number'><a name='L738' href='#L738'><pre>738</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap(),</pre></td></tr><tr><td class='line-number'><a name='L739' href='#L739'><pre>739</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> aclass: DnsAClass::IN,</pre></td></tr><tr><td class='line-number'><a name='L740' href='#L740'><pre>740</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ttl: 0x12345678,</pre></td></tr><tr><td class='line-number'><a name='L741' href='#L741'><pre>741</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> rdata: DnsAType::A(A { address: Ipv4Addr::new(127, 0, 0, 1) }),</pre></td></tr><tr><td class='line-number'><a name='L742' href='#L742'><pre>742</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cache_flush: false,</pre></td></tr><tr><td class='line-number'><a name='L743' href='#L743'><pre>743</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L744' href='#L744'><pre>744</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> answers.complete().unwrap()</pre></td></tr><tr><td class='line-number'><a name='L745' href='#L745'><pre>745</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L746' href='#L746'><pre>746</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer = message.complete().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L747' href='#L747'><pre>747</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L748' href='#L748'><pre>748</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(</pre></td></tr><tr><td class='line-number'><a name='L749' href='#L749'><pre>749</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer.as_slice(),</pre></td></tr><tr><td class='line-number'><a name='L750' href='#L750'><pre>750</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L751' href='#L751'><pre>751</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x12, 0x34, // ID</pre></td></tr><tr><td class='line-number'><a name='L752' href='#L752'><pre>752</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0b0000_0000, 0b0000_0000, // Flags</pre></td></tr><tr><td class='line-number'><a name='L753' href='#L753'><pre>753</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Question count</pre></td></tr><tr><td class='line-number'><a name='L754' href='#L754'><pre>754</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Answer count</pre></td></tr><tr><td class='line-number'><a name='L755' href='#L755'><pre>755</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Authority count</pre></td></tr><tr><td class='line-number'><a name='L756' href='#L756'><pre>756</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Additional count</pre></td></tr><tr><td class='line-number'><a name='L757' href='#L757'><pre>757</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // Name</pre></td></tr><tr><td class='line-number'><a name='L758' href='#L758'><pre>758</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e', // Name</pre></td></tr><tr><td class='line-number'><a name='L759' href='#L759'><pre>759</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm', // Name</pre></td></tr><tr><td class='line-number'><a name='L760' href='#L760'><pre>760</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // Name</pre></td></tr><tr><td class='line-number'><a name='L761' href='#L761'><pre>761</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Type</pre></td></tr><tr><td class='line-number'><a name='L762' href='#L762'><pre>762</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Class</pre></td></tr><tr><td class='line-number'><a name='L763' href='#L763'><pre>763</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x12, 0x34, 0x56, 0x78, // TTL</pre></td></tr><tr><td class='line-number'><a name='L764' href='#L764'><pre>764</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x04, // Data length</pre></td></tr><tr><td class='line-number'><a name='L765' href='#L765'><pre>765</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 127, 0, 0, 1, // Data</pre></td></tr><tr><td class='line-number'><a name='L766' href='#L766'><pre>766</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ].as_slice()</pre></td></tr><tr><td class='line-number'><a name='L767' href='#L767'><pre>767</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L768' href='#L768'><pre>768</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L769' href='#L769'><pre>769</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Decode the message again and check that it is the same</pre></td></tr><tr><td class='line-number'><a name='L770' href='#L770'><pre>770</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message: DnsMessage<8, { DnsSection::Answers }, _> = DnsMessage::new(buffer).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L771' href='#L771'><pre>771</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().id(), 0x1234);</pre></td></tr><tr><td class='line-number'><a name='L772' href='#L772'><pre>772</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().opcode(), DnsHeaderOpcode::Query);</pre></td></tr><tr><td class='line-number'><a name='L773' href='#L773'><pre>773</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().authoritative_answer(), false);</pre></td></tr><tr><td class='line-number'><a name='L774' href='#L774'><pre>774</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().truncated(), false);</pre></td></tr><tr><td class='line-number'><a name='L775' href='#L775'><pre>775</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_desired(), false);</pre></td></tr><tr><td class='line-number'><a name='L776' href='#L776'><pre>776</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_available(), false);</pre></td></tr><tr><td class='line-number'><a name='L777' href='#L777'><pre>777</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().response_code(), DnsHeaderResponseCode::NoError);</pre></td></tr><tr><td class='line-number'><a name='L778' href='#L778'><pre>778</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut answers = message.answers();</pre></td></tr><tr><td class='line-number'><a name='L779' href='#L779'><pre>779</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut answer_iter = answers.iter().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L780' href='#L780'><pre>780</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let answer = answer_iter.next().unwrap().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L781' href='#L781'><pre>781</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(answer.name, DnsName::from_bytes(b"\x03www\x07example\x03com\x00").unwrap());</pre></td></tr><tr><td class='line-number'><a name='L782' href='#L782'><pre>782</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(answer.ttl, 0x12345678);</pre></td></tr><tr><td class='line-number'><a name='L783' href='#L783'><pre>783</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(answer.into_parsed().unwrap().rdata, DnsAType::A(A { address: Ipv4Addr::new(127, 0, 0, 1) }));</pre></td></tr><tr><td class='line-number'><a name='L784' href='#L784'><pre>784</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert!(answer_iter.next().is_none());</pre></td></tr><tr><td class='line-number'><a name='L785' href='#L785'><pre>785</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L786' href='#L786'><pre>786</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L787' href='#L787'><pre>787</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L788' href='#L788'><pre>788</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mod error {</pre></td></tr><tr><td class='line-number'><a name='L789' href='#L789'><pre>789</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::header::{DnsHeaderOpcode, DnsHeaderResponseCode};</pre></td></tr><tr><td class='line-number'><a name='L790' href='#L790'><pre>790</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L791' href='#L791'><pre>791</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L792' href='#L792'><pre>792</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L793' href='#L793'><pre>793</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn truncated() {</pre></td></tr><tr><td class='line-number'><a name='L794' href='#L794'><pre>794</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer: ArrayVec<u8, 12> = ArrayVec::from([</pre></td></tr><tr><td class='line-number'><a name='L795' href='#L795'><pre>795</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x12, 0x34, // ID</pre></td></tr><tr><td class='line-number'><a name='L796' href='#L796'><pre>796</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0b0000_0000, 0b0000_0000, // Flags</pre></td></tr><tr><td class='line-number'><a name='L797' href='#L797'><pre>797</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // Question count</pre></td></tr><tr><td class='line-number'><a name='L798' href='#L798'><pre>798</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Answer count</pre></td></tr><tr><td class='line-number'><a name='L799' href='#L799'><pre>799</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Authority count</pre></td></tr><tr><td class='line-number'><a name='L800' href='#L800'><pre>800</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, // Additional count</pre></td></tr><tr><td class='line-number'><a name='L801' href='#L801'><pre>801</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Premature end of message</pre></td></tr><tr><td class='line-number'><a name='L802' href='#L802'><pre>802</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ]);</pre></td></tr><tr><td class='line-number'><a name='L803' href='#L803'><pre>803</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let message: DnsMessage<8, { DnsSection::Questions }, _> = DnsMessage::new(buffer).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L804' href='#L804'><pre>804</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().id(), 0x1234);</pre></td></tr><tr><td class='line-number'><a name='L805' href='#L805'><pre>805</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().opcode(), DnsHeaderOpcode::Query);</pre></td></tr><tr><td class='line-number'><a name='L806' href='#L806'><pre>806</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().authoritative_answer(), false);</pre></td></tr><tr><td class='line-number'><a name='L807' href='#L807'><pre>807</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().truncated(), false);</pre></td></tr><tr><td class='line-number'><a name='L808' href='#L808'><pre>808</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_desired(), false);</pre></td></tr><tr><td class='line-number'><a name='L809' href='#L809'><pre>809</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().recursion_available(), false);</pre></td></tr><tr><td class='line-number'><a name='L810' href='#L810'><pre>810</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(message.header().unwrap().response_code(), DnsHeaderResponseCode::NoError);</pre></td></tr><tr><td class='line-number'><a name='L811' href='#L811'><pre>811</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut questions = message.questions();</pre></td></tr><tr><td class='line-number'><a name='L812' href='#L812'><pre>812</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut question_iter = questions.iter().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L813' href='#L813'><pre>813</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(</pre></td></tr><tr><td class='line-number'><a name='L814' href='#L814'><pre>814</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> question_iter.next(),</pre></td></tr><tr><td class='line-number'><a name='L815' href='#L815'><pre>815</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Some(Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer)))</pre></td></tr><tr><td class='line-number'><a name='L816' href='#L816'><pre>816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L817' href='#L817'><pre>817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L818' href='#L818'><pre>818</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L819' href='#L819'><pre>819</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/name.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L11'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::fmt::{Debug, Display, Formatter};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsError, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::ParseBytes;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const MAX_DOMAIN_NAME_LENGTH: usize = 255;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const MAX_DOMAIN_NAME_DEPTH: usize = 128;</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const MAX_DOMAIN_NAME_LABEL_LENGTH: usize = 63;</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A DNS name.</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Clone</span>, Copy)]</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> bytes: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> offset: usize,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[macro_export]</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>macro_rules! dns_name {</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ($value:expr $(,)?) => {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const NAME: [u8; $value.len() + 2] = {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut result = [0; $value.len() + 2];</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut label_start = 0;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut index = 0;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> loop {</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if index == $value.len() {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[label_start] = (index - label_start) as u8;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let byte = $value[index];</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if byte == b'.' {</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[label_start] = (index - label_start) as u8;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> label_start = index + 1;</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[index + 1] = byte;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> index += 1;</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe { DnsName::from_bytes_unchecked(&NAME) }</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseBytes<'a> for DnsName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> const MAX_LENGTH: usize = 255;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> let mut j = *i;</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>174M</pre></td><td class='code'><pre> loop {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='covered-line'><pre>174M</pre></td><td class='code'><pre> if j - *i >= MAX_LENGTH {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>1.76M</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::NameTooLong));</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>172M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>172M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='covered-line'><pre>172M</pre></td><td class='code'><pre> match LabelType::from_bytes(bytes, &mut j)? {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> LabelType::Pointer(_) => {</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre> LabelType::Part(len) => {</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre> j += len as usize;</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre> if len == 0 {</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='covered-line'><pre>4.62k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre> if len > MAX_DOMAIN_NAME_LABEL_LENGTH as u8 {</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Err(DnsMessageError::DnsError(DnsError::LabelTooLong))</span>;</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='covered-line'><pre>4.67k</pre></td><td class='code'><pre> let offset = *i;</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='covered-line'><pre>4.67k</pre></td><td class='code'><pre> *i = j;</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='covered-line'><pre>4.67k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>4.67k</pre></td><td class='code'><pre> Ok(Self { bytes, offset })</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DnsName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Create a new name from a string (Dot-separated labels).</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn from_str(s: &'a mut str) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check that the name is ascii and that it is not too long.</span></pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert!(s.is_ascii())</span>;</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>assert!(s.len() <= MAX_DOMAIN_NAME_LENGTH)</span>;</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>bytes = unsafe { s.as_bytes_mut() };</span></pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut l = 0; // The length of the current label.</span></pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut iter = bytes.iter_mut();</span></pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut part_len_byte = iter.next().unwrap();</span></pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut last_byte = *part_len_byte</span>; // The last byte visited.</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> while let Some(<span class='red'>byte</span>) = <span class='red'>iter.next()</span> {</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>b = *byte;</span></pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if b == b'.'</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We've reached the end of a label.</span></pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *part_len_byte = l as u8;</span></pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> l = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *byte = last_byte;</span></pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> part_len_byte = iter.next().unwrap();</span></pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> last_byte = *part_len_byte;</span></pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span> else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We're still in the middle of a label.</span></pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> l += 1;</span></pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *byte = last_byte;</span></pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> last_byte = b;</span></pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Self { bytes, offset: 0 }</span></pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Read a name from a byte buffer (DNS wire format).</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, DnsMessageError> </span>{</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>part</span> in (NameIterator {</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>bytes,</span></pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> offset: 0,</span></pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> depth: ArrayVec::new()</span>,</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }) {</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>part</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(Self { bytes, offset: 0 })</span></pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Read a name from a byte buffer (DNS wire format).</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const unsafe fn from_bytes_unchecked(bytes: &'a [u8]) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Self { bytes, offset: 0 }</span></pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_name(*self)</span></pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn iter(&self) -> NameIterator<'a> {</span></pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NameIterator {</span></pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bytes: self.bytes,</span></pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> offset: self.offset,</span></pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> depth: ArrayVec::new(),</span></pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn split_first(&self) -> Result<(&'a [u8], Option<Self>), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut iter = self.iter()</span>;</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>first</span> = <span class='red'>iter.next().unwrap()</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if let Some(<span class='red'>next</span>) = <span class='red'>iter.next()</span> {</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>next</span> = <span class='red'>next</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Calculate offset from address of the second pointer.</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>offset = next.as_ptr() as usize - self.bytes.as_ptr() as usize - 1;</span></pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok((first, Some(Self {</span></pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bytes: self.bytes,</span></pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> offset,</span></pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> })))</span></pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok((first, None))</span></pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn verify(&self) -> Result<(), DnsMessageError> </span>{</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>part</span> in <span class='red'>self.iter()</span> {</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>part</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> self.iter().map(|part| <span class='red'>part.map(</span>|part| <span class='red'>part.len() + 1</span><span class='red'>)</span>).sum()</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct NameIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> bytes: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> offset: usize,</pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> depth: ArrayVec<usize, MAX_DOMAIN_NAME_DEPTH>,</pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Iterator for NameIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = Result<&'a [u8], DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn next(&mut self) -> Option<Self::Item> {</span></pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut i = self.offset</span>;</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>loop {</span></pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.depth.push(i);</span></pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.depth.len() >= MAX_DOMAIN_NAME_DEPTH</span> {</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>None</span>;</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match LabelType::from_bytes(self.bytes, &mut i).unwrap()</span> {</pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> LabelType::Pointer(<span class='red'>ptr) => {</span></pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if ptr < self.offset as u16</span> {</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // The pointer points to an earlier part of the message.</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>i = ptr as usize;</span></pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.depth.contains(&i)</span> {</pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // The pointer points to a part of the message that we've already visited.</pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Some(Err(DnsMessageError::DnsError(DnsError::PointerCycle)))</span>;</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue</span>;</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // The pointer points into the future.</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Some(Err(DnsMessageError::DnsError(DnsError::PointerIntoTheFuture)))</span>;</pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> LabelType::Part(<span class='red'>len) => {</span></pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if len == 0</span> {</pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // We've reached the end of the name.</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>None</span>;</pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if len > MAX_DOMAIN_NAME_LABEL_LENGTH as u8</span> {</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Some(Err(DnsMessageError::DnsError(DnsError::LabelTooLong)))</span>;</pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.bytes.len() < i + len as usize</span> {</pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // The name is longer than the buffer.</pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Some(Err(DnsMessageError::DnsError(DnsError::MessageTooShort)))</span>;</pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let part = &self.bytes[i..i + len as usize];</span></pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.offset = i + len as usize;</span></pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Some(Ok(part))</span></pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl PartialEq<DnsName<'_>> for DnsName<'_> {</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn eq(&self, other: &DnsName<'_>) -> bool </span>{</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for (<span class='red'>a, b</span>) in <span class='red'>self.iter().zip(other.iter())</span> {</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> match (<span class='red'>a, b</span>) {</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (Ok(<span class='red'>a), Ok(b)) => {</span></pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if a != b</span> {</pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>false</span>;</pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> _ => {</pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>false</span>;</pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>true</span></pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl Display for DnsName<'_> {</pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {</span></pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let mut first = true</span>;</pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>part</span> in <span class='red'>self.iter()</span> {</pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> if <span class='red'>first</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> first = false;</span></pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>f.write_str(".")</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>part</span> = <span class='red'>part.map_err(</span>|_| <span class='red'>core::fmt::Error</span><span class='red'>)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>f.write_str(core::str::from_utf8(part).unwrap())</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl Debug for DnsName<'_> {</pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {</pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>f.write_str("DnsName(")</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Display::fmt(self, f)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>f.write_str(")")</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>enum LabelType {</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Pointer(u16),</pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Part(u8),</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl LabelType {</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='covered-line'><pre>172M</pre></td><td class='code'><pre> fn from_bytes(bytes: &[u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_MASK: u8 = 0b11000000;</pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const LEN_MASK: u8 = !PTR_MASK;</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='covered-line'><pre>172M</pre></td><td class='code'><pre> let c = u8::parse_bytes(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L305' href='#L305'><pre>305</pre></a></td><td class='covered-line'><pre>116M</pre></td><td class='code'><pre> if c & PTR_MASK == PTR_MASK {</pre></td></tr><tr><td class='line-number'><a name='L306' href='#L306'><pre>306</pre></a></td><td class='covered-line'><pre>15.4M</pre></td><td class='code'><pre> let c = c & LEN_MASK;</pre></td></tr><tr><td class='line-number'><a name='L307' href='#L307'><pre>307</pre></a></td><td class='covered-line'><pre>15.4M</pre></td><td class='code'><pre> let pointer = u16::from_be_bytes([c, u8::parse_bytes(bytes, i)?]);</pre></td></tr><tr><td class='line-number'><a name='L308' href='#L308'><pre>308</pre></a></td><td class='covered-line'><pre>11.5M</pre></td><td class='code'><pre> if pointer >= *i as u16 {</pre></td></tr><tr><td class='line-number'><a name='L309' href='#L309'><pre>309</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Cannot point to the future.</pre></td></tr><tr><td class='line-number'><a name='L310' href='#L310'><pre>310</pre></a></td><td class='covered-line'><pre>11.5M</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::PointerIntoTheFuture));</pre></td></tr><tr><td class='line-number'><a name='L311' href='#L311'><pre>311</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L312' href='#L312'><pre>312</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L313' href='#L313'><pre>313</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> Ok(Self::Pointer(pointer))</pre></td></tr><tr><td class='line-number'><a name='L314' href='#L314'><pre>314</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L315' href='#L315'><pre>315</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre> let len = c & LEN_MASK;</pre></td></tr><tr><td class='line-number'><a name='L316' href='#L316'><pre>316</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L317' href='#L317'><pre>317</pre></a></td><td class='covered-line'><pre>101M</pre></td><td class='code'><pre> Ok(Self::Part(len))</pre></td></tr><tr><td class='line-number'><a name='L318' href='#L318'><pre>318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L319' href='#L319'><pre>319</pre></a></td><td class='covered-line'><pre>172M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L320' href='#L320'><pre>320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/name_servers.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L30'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::answer::DnsAClass;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::question::DnsQType;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{DnsAType, RData};</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsNameServers<</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> {</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message: DnsMessage<PTR_STORAGE, { DnsSection::NameServers }, B>,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> remaining: usize,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsNameServers<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn new(message: DnsMessage<PTR_STORAGE, { DnsSection::NameServers }, B>) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let remaining = message.header().unwrap().answer_count() as usize;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Self {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> message,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining,</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns12name_serversINtB2_14DnsNameServersKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE3newCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn new(message: DnsMessage<PTR_STORAGE, { DnsSection::NameServers }, B>) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let remaining = message.header().unwrap().answer_count() as usize;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Self {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> message,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining,</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns12name_serversINtB2_14DnsNameServersKppE3newB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn append(&mut self, answer: NameServer<DnsAType>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let (buffer, position) = self.message.buffer_and_position();</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Truncate the buffer to the current position.</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> buffer.truncate(*position)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>answer.write(&mut self.message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Set answer_count in the header to the current answer count + 1.</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>answer_count = self.message.header().unwrap().answer_count();</span></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let answer_count = answer_count + 1 - self.remaining as u16;</span></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_answer_count(answer_count);</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_name_server_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_additional_records_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.remaining = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn iter(&mut self) -> Result<DnsNameServersIterator, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let (buffer, position) = self.message.buffer_and_position();</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let buffer = buffer.bytes();</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsNameServersIterator {</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> current_position: position,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining: &mut self.remaining,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns12name_serversINtB2_14DnsNameServersKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE4iterCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn iter(&mut self) -> Result<DnsNameServersIterator, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let (buffer, position) = self.message.buffer_and_position();</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let buffer = buffer.bytes();</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsNameServersIterator {</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> current_position: position,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining: &mut self.remaining,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns12name_serversINtB2_14DnsNameServersKppE4iterB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn complete(mut self) -> Result<DnsMessage<PTR_STORAGE, { DnsSection::Additionals }, B>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.remaining != 0 {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>x</span> in <span class='red'>self.iter()</span><span class='red'>?</span> { <span class='red'>x</span><span class='red'>?</span>; }</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsMessage {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer: self.message.buffer,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: self.message.position,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: self.message.ptr_storage,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns12name_serversINtB2_14DnsNameServersKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE8completeCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn complete(mut self) -> Result<DnsMessage<PTR_STORAGE, { DnsSection::Additionals }, B>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.remaining != 0 {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>x</span> in <span class='red'>self.iter()</span><span class='red'>?</span> { <span class='red'>x</span><span class='red'>?</span>; }</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsMessage {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer: self.message.buffer,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: self.message.position,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: self.message.ptr_storage,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns12name_serversINtB2_14DnsNameServersKppE8completeB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsNameServersIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> current_position: &'a mut usize,</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> remaining: &'a mut usize,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Iterator for DnsNameServersIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = Result<NameServer<'a, RData<'a>>, DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> if *self.remaining == 0 {</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let name_server = NameServer::parse(</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> self.buffer, self.current_position</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> *self.remaining -= 1;</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> Some(name_server)</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs_NtCslLTLXfmDngu_8flex_dns12name_serversNtB4_22DnsNameServersIteratorNtNtNtNtCs6xNykbTfrCs_4core4iter6traits8iterator8Iterator4nextCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> if *self.remaining == 0 {</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let name_server = NameServer::parse(</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> self.buffer, self.current_position</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> *self.remaining -= 1;</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> Some(name_server)</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='covered-line'><pre>22.6M</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs_NtCslLTLXfmDngu_8flex_dns12name_serversNtB4_22DnsNameServersIteratorNtNtNtNtCs6xNykbTfrCs_4core4iter6traits8iterator8Iterator4nextB6_</pre></div></div></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct NameServer<'a, D> {</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub rdata: D,</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub cache_flush: bool,</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub aclass: DnsAClass,</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub ttl: u32,</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> NameServer<'a, RData<'a>> {</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> pub fn parse(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> let name = DnsName::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> let atype_id = u16::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> let atype = DnsQType::from_id(atype_id);</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> let cache_flush = atype_id & 0b1000_0000_0000_0000 != 0;</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> let aclass = DnsAClass::from_id(u16::parse(bytes, i)?);</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='covered-line'><pre>165</pre></td><td class='code'><pre> let ttl = u32::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='covered-line'><pre>150</pre></td><td class='code'><pre> let rdata = RData::parse(bytes, i, atype)?;</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> name,</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> rdata,</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> cache_flush,</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> aclass,</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> ttl,</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='covered-line'><pre>22.5M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the name to the buffer using the pointer storage for compression.</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>message.write_name(self.name)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the atype and aclass to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.id().write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut aclass = self.aclass.id();</span></pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.cache_flush</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> aclass |= 0b1000_0000;</span></pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>aclass.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the ttl to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.ttl.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (<span class='red'>self.rdata.byte_len()</span><span class='red'>?</span> as u16).<span class='red'>write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the type specific data to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> pub fn into_parsed(self) -> Result<NameServer<'a, DnsAType<'a>>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> Ok(NameServer {</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> name: self.name,</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> rdata: self.rdata.into_parsed()?,</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> cache_flush: self.cache_flush,</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> aclass: self.aclass,</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> ttl: self.ttl,</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='covered-line'><pre>103</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> NameServer<'a, DnsAType<'a>> {</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the name to the buffer using the pointer storage for compression.</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.name.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the atype and aclass to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.id().write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut aclass = self.aclass.id();</span></pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.cache_flush</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> aclass |= 0b1000_0000;</span></pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>aclass.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the ttl to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.ttl.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>rdata_len</span> = <span class='red'>self.rdata.byte_len()</span><span class='red'>?</span> as u16;</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>rdata_len.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Write the type specific data to the buffer.</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rdata.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/parse.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::net::{Ipv4Addr, Ipv6Addr};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{DnsError, DnsMessageError};</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub(crate) trait ParseData<'a> {</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn parse_data(&self) -> &'a [u8];</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseData<'a> for &'a [u8] {</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> fn parse_data(&self) -> &'a [u8] {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> *self</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub(crate) trait Parse<'a>: Sized {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, S: ParseBytes<'a>> Parse<'a> for S {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseAhj6_NtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseNtNtB7_10characters10CharactersNtB5_5Parse5parseRShEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>252</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>252</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>252</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseNtNtNtCs6xNykbTfrCs_4core3net7ip_addr8Ipv4AddrNtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parsehNtB5_5Parse5parseRShEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>263</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>263</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>263</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseNtNtB7_4name7DnsNameNtB5_5Parse5parseRShEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>72.9M</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseNtNtNtCs6xNykbTfrCs_4core3net7ip_addr8Ipv6AddrNtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parsetNtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>762</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>762</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>762</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseAhj8_NtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parsetNtB5_5Parse5parseRShEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parsemNtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>179</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>179</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>179</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parsemNtB5_5Parse5parseRShEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>3.20k</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>3.20k</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>3.20k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parsehNtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>565</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>565</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>565</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseyNtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseNtNtB7_4name7DnsNameNtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>234</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>234</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>234</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RINvXs_NtCslLTLXfmDngu_8flex_dns5parseNtNtB7_10characters10CharactersNtB5_5Parse5parseRNtNtB7_5rdata5RDataEB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>518</pre></td><td class='code'><pre> fn parse<T: ParseData<'a>>(bytes: T, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>518</pre></td><td class='code'><pre> Self::parse_bytes(bytes.parse_data(), i)</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>518</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub(crate) trait ParseBytes<'a>: Sized {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseBytes<'a> for u8 {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>187M</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>187M</pre></td><td class='code'><pre> if bytes.len() < *i + 1 {</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>59.5M</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>128M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>128M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>128M</pre></td><td class='code'><pre> let value = bytes[*i];</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>128M</pre></td><td class='code'><pre> *i += 1;</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>128M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>128M</pre></td><td class='code'><pre> Ok(value)</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>187M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseBytes<'a> for u16 {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>12.0k</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>12.0k</pre></td><td class='code'><pre> if bytes.len() < *i + 2 {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>557</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre> let value = u16::from_be_bytes([</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre> bytes[*i],</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre> bytes[*i + 1]</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre> ]);</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre> *i += 2;</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre> Ok(value)</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>12.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseBytes<'a> for u32 {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> if bytes.len() < *i + 4 {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>206</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> let value = u32::from_be_bytes([</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> bytes[*i],</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> bytes[*i + 1],</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> bytes[*i + 2],</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> bytes[*i + 3]</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> ]);</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> *i += 4;</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> Ok(value)</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='covered-line'><pre>3.38k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseBytes<'a> for u64 {</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if bytes.len() < *i + 8 {</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> let value = u64::from_be_bytes([</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> bytes[*i],</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> bytes[*i + 1],</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> bytes[*i + 2],</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> bytes[*i + 3],</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> bytes[*i + 4],</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> bytes[*i + 5],</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> bytes[*i + 6],</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> bytes[*i + 7]</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> ]);</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> *i += 8;</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> Ok(value)</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a, const SIZE: usize> ParseBytes<'a> for [u8; SIZE] {</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> if bytes.len() < *i + SIZE {</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let mut value = [0u8; SIZE];</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> value.copy_from_slice(&bytes[*i..*i + SIZE]);</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> *i += SIZE;</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Ok(value)</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs4_NtCslLTLXfmDngu_8flex_dns5parseAhj6_NtB5_10ParseBytes11parse_bytesB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if bytes.len() < *i + SIZE {</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> let mut value = [0u8; SIZE];</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> value.copy_from_slice(&bytes[*i..*i + SIZE]);</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> *i += SIZE;</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Ok(value)</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs4_NtCslLTLXfmDngu_8flex_dns5parseAhj8_NtB5_10ParseBytes11parse_bytesB7_</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if bytes.len() < *i + SIZE {</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> let mut value = [0u8; SIZE];</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> value.copy_from_slice(&bytes[*i..*i + SIZE]);</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> *i += SIZE;</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Ok(value)</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseBytes<'a> for Ipv4Addr {</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> if bytes.len() < *i + 4 {</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> let address = Ipv4Addr::new(</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> bytes[*i],</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> bytes[*i + 1],</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> bytes[*i + 2],</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> bytes[*i + 3]</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> *i += 4;</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Ok(address)</pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseBytes<'a> for Ipv6Addr {</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> fn parse_bytes(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if bytes.len() < *i + 16 {</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> let address = Ipv6Addr::new(</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ((bytes[*i] as u16) << 8) | (bytes[*i + 1] as u16),</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ((bytes[*i + 2] as u16) << 8) | (bytes[*i + 3] as u16),</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ((bytes[*i + 4] as u16) << 8) | (bytes[*i + 5] as u16),</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ((bytes[*i + 6] as u16) << 8) | (bytes[*i + 7] as u16),</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ((bytes[*i + 8] as u16) << 8) | (bytes[*i + 9] as u16),</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ((bytes[*i + 10] as u16) << 8) | (bytes[*i + 11] as u16),</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ((bytes[*i + 12] as u16) << 8) | (bytes[*i + 13] as u16),</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ((bytes[*i + 14] as u16) << 8) | (bytes[*i + 15] as u16),</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> *i += 16;</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> Ok(address)</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/question.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L27'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsQuestions<</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> {</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> message: DnsMessage<PTR_STORAGE, { DnsSection::Questions }, B>,</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> remaining: usize,</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>> DnsQuestions<PTR_STORAGE, B> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn new(message: DnsMessage<PTR_STORAGE, { DnsSection::Questions }, B>) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let remaining = message.header().unwrap().question_count() as usize;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Self {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> message,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns8questionINtB2_12DnsQuestionsKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE3newCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub(crate) fn new(message: DnsMessage<PTR_STORAGE, { DnsSection::Questions }, B>) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let remaining = message.header().unwrap().question_count() as usize;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Self {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> message,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns8questionINtB2_12DnsQuestionsKppE3newB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn append(&mut self, question: DnsQuestion) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let (buffer, position) = self.message.buffer_and_position();</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Truncate the buffer to the current position.</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> buffer.truncate(*position)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>question.write(&mut self.message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Set question_count in the header to the current question count + 1.</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>question_count = self.message.header().unwrap().question_count();</span></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let question_count = question_count + 1 - self.remaining as u16;</span></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_question_count(question_count);</span></pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_answer_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_name_server_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.message.header_mut()</span><span class='red'>?</span>.<span class='red'>set_additional_records_count(0);</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.remaining = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn iter(&mut self) -> Result<DnsQuestionIterator, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let (buffer, position) = self.message.buffer_and_position();</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let buffer = buffer.bytes();</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsQuestionIterator {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> current_position: position,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining: &mut self.remaining,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns8questionINtB2_12DnsQuestionsKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE4iterCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn iter(&mut self) -> Result<DnsQuestionIterator, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let (buffer, position) = self.message.buffer_and_position();</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> let buffer = buffer.bytes();</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsQuestionIterator {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> current_position: position,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> remaining: &mut self.remaining,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns8questionINtB2_12DnsQuestionsKppE4iterB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn complete(mut self) -> Result<DnsMessage<PTR_STORAGE, { DnsSection::Answers }, B>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.remaining != 0 {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>x</span> in <span class='red'>self.iter()</span><span class='red'>?</span> { <span class='red'>x</span><span class='red'>?</span>; }</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsMessage {</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer: self.message.buffer,</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: self.message.position,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: self.message.ptr_storage,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvMNtCslLTLXfmDngu_8flex_dns8questionINtB2_12DnsQuestionsKj10_INtNtCskQaAGJdWXwX_8arrayvec8arrayvec8ArrayVechKj1000_EE8completeCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> pub fn complete(mut self) -> Result<DnsMessage<PTR_STORAGE, { DnsSection::Answers }, B>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if self.remaining != 0 {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>x</span> in <span class='red'>self.iter()</span><span class='red'>?</span> { <span class='red'>x</span><span class='red'>?</span>; }</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Ok(DnsMessage {</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> buffer: self.message.buffer,</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> position: self.message.position,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> ptr_storage: self.message.ptr_storage,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvMNtCslLTLXfmDngu_8flex_dns8questionINtB2_12DnsQuestionsKppE8completeB4_</pre></div></div></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsQuestionIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> current_position: &'a mut usize,</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> remaining: &'a mut usize,</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Iterator for DnsQuestionIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = Result<DnsQuestion<'a>, DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> if *self.remaining == 0 {</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> let question = DnsQuestion::parse(</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> self.buffer, self.current_position</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> *self.remaining -= 1;</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> Some(question)</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> }</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>_RNvXs_NtCslLTLXfmDngu_8flex_dns8questionNtB4_19DnsQuestionIteratorNtNtNtNtCs6xNykbTfrCs_4core4iter6traits8iterator8Iterator4nextCsgg978DXfVXR_13fuzz_target_1</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> fn next(&mut self) -> Option<Self::Item> {</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> if *self.remaining == 0 {</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return None;</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> let question = DnsQuestion::parse(</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> self.buffer, self.current_position</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> *self.remaining -= 1;</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> Some(question)</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> }</pre></td></tr></table></div></div><div class='expansion-view'><div class='source-name-title'><pre>Unexecuted instantiation: _RNvXs_NtCslLTLXfmDngu_8flex_dns8questionNtB4_19DnsQuestionIteratorNtNtNtNtCs6xNykbTfrCs_4core4iter6traits8iterator8Iterator4nextB6_</pre></div></div></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsQuestion<'a> {</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub qtype: DnsQType,</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub qclass: DnsQClass,</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DnsQuestion<'a> {</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> pub fn parse(bytes: &'a [u8], i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> let name = DnsName::parse(bytes, i)?;</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> let qtype = u16::parse(bytes, i)?.into();</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> let qclass = u16::parse(bytes, i)?.into();</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> name,</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> qtype,</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> qclass,</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='covered-line'><pre>5.12M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.name.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.qtype.id().write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.qclass.id().write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(())</span></pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The kind of a DNS query.</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// According to [RFC 1035 Section 3.2.2](https://tools.ietf.org/rfc/rfc1035#section-3.2.2)</pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// and [RFC 1035 Section 3.2.3](https://tools.ietf.org/rfc/rfc1035#section-3.2.3).</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[repr(u16)]</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsQType {</pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> A = 1,</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NS = 2,</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CNAME = 5,</pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SOA = 6,</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> PTR = 12,</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HINFO = 13,</pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> MX = 15,</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TXT = 16,</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> RP = 17,</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AFSDB = 18,</pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SIG = 24,</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> KEY = 25,</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AAAA = 28,</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> LOC = 29,</pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SRV = 33,</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NAPTR = 35,</pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> KX = 36,</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CERT = 37,</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DNAME = 39,</pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> OPT = 41,</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APL = 42,</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DS = 43,</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SSHFP = 44,</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IPSECKEY = 45,</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> RRSIG = 46,</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NSEC = 47,</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DNSKEY = 48,</pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DHCID = 49,</pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NSEC3 = 50,</pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NSEC3PARAM = 51,</pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TLSA = 52,</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SMIMEA = 53,</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HIP = 55,</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CDS = 59,</pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CDNSKEY = 60,</pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> OPENPGPKEY = 61,</pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CSYNC = 62,</pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ZONEMD = 63,</pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SVCB = 64,</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HTTPS = 65,</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> EUI48 = 108,</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> EUI64 = 109,</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TKEY = 249,</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TSIG = 250,</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IXFR = 251,</pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AXFR = 252,</pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ALL = 255,</pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> URI = 256,</pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CAA = 257,</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TA = 32768,</pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DLV = 32769,</pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Reserved,</pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl DnsQType {</pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='covered-line'><pre>3.93k</pre></td><td class='code'><pre> pub fn from_id(id: u16) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='covered-line'><pre>3.93k</pre></td><td class='code'><pre> match id {</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='covered-line'><pre>2.76k</pre></td><td class='code'><pre> 1..=2 | 5..=6 | 12..=13 | 15..=18 | 24..=25 | 28..=29</pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> | 33 | 35..=37 | 39 | 41..=53 | 55 | 59..=65</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='covered-line'><pre>918</pre></td><td class='code'><pre> | 108..=109 | 249..=252 | 255 | 256 | 257</pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='covered-line'><pre>238</pre></td><td class='code'><pre> | 32768..=32769 => unsafe {</pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='covered-line'><pre>1.96k</pre></td><td class='code'><pre> core::mem::transmute(id)</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='covered-line'><pre>1.97k</pre></td><td class='code'><pre> _ => DnsQType::Reserved,</pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='covered-line'><pre>3.93k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn id(&self) -> u16 {</pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> match self {</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsQType::Reserved => panic!("Reserved QType"),</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> _ => *self as u16,</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<DnsQType> for u16 {</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn from(q: DnsQType) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsQType::id(&q)</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<u16> for DnsQType {</pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> fn from(n: u16) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> DnsQType::from_id(n)</pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The class of a DNS query.</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// According to [RFC 1035 Section 3.2.4](https://tools.ietf.org/rfc/rfc1035#section-3.2.4).</pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[repr(u16)]</pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsQClass {</pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Internet</pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IN = 1,</pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// CSNET</pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CS = 2,</pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// CHAOS</pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CH = 3,</pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Hesiod</pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HS = 4,</pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Reserved,</pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl DnsQClass {</pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> pub fn from_id(id: u16) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> match id {</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='covered-line'><pre>595</pre></td><td class='code'><pre> 1..=4 => unsafe { core::mem::transmute(id) },</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='covered-line'><pre>913</pre></td><td class='code'><pre> _ => DnsQClass::Reserved,</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn id(&self) -> u16 {</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> match self {</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsQClass::Reserved => panic!("Reserved QClass"),</pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> _ => *self as u16,</pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<DnsQClass> for u16 {</pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn from(q: DnsQClass) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsQClass::id(&q)</pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl From<u16> for DnsQClass {</pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> fn from(n: u16) -> Self {</pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> DnsQClass::from_id(n)</pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='covered-line'><pre>958</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L108'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod a;</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod ns;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod cname;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod soa;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod ptr;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod hinfo;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod mx;</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod txt;</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod rp;</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod afsdb;</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod sig;</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod key;</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod aaaa;</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod loc;</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod srv;</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod naptr;</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod kx;</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod cert;</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod dname;</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod opt;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod apl;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod ds;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod sshfp;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod ipseckey;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod rrsig;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod nsec;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod dnskey;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod dhcid;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod nsec3;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod nsec3param;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod tlsa;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod smimea;</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod hip;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod cds;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod cdnskey;</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod openpgpkey;</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod csync;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod zonemd;</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod svcb;</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod https;</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod eui48;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod eui64;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod tkey;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod tsig;</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod ixfr;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod axfr;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod uri;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod caa;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod ta;</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod dlv;</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use a::A;</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use ns::Ns;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use cname::CName;</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use soa::Soa;</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use ptr::Ptr;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use hinfo::HInfo;</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use mx::Mx;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use txt::Txt;</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use rp::Rp;</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use afsdb::AfsDb;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use sig::Sig;</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use key::Key;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use aaaa::Aaaa;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use loc::Loc;</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use srv::Srv;</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use naptr::Naptr;</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use kx::Kx;</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use cert::Cert;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use dname::DName;</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use opt::Opt;</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use apl::Apl;</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use ds::Ds;</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use sshfp::SshFp;</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use ipseckey::IpSecKey;</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use rrsig::RRSig;</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use nsec::Nsec;</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use dnskey::DnsKey;</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use dhcid::DhcId;</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use nsec3::Nsec3;</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use nsec3param::Nsec3Param;</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use tlsa::Tlsa;</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use smimea::SmimeA;</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use hip::Hip;</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use cds::Cds;</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use cdnskey::CdnsKey;</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use openpgpkey::OpenPgpKey;</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use csync::CSync;</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use zonemd::ZoneMd;</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use svcb::Svcb;</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use https::Https;</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use eui48::EUI48;</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use eui64::EUI64;</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use tkey::TKey;</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use tsig::TSig;</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use ixfr::IXfr;</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use axfr::AXfr;</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use uri::Uri;</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use caa::Caa;</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use ta::Ta;</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub use dlv::Dlv;</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsError, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::{Parse, ParseData};</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::question::DnsQType;</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>Debug</span>, <span class='red'>Clone</span>, Copy, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct RData<'a> {</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pos: usize,</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> len: usize,</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_: DnsQType,</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseData<'a> for RData<'a> {</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> fn parse_data(&self) -> &'a [u8] {</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> self.buffer</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ParseData<'a> for &'_ RData<'a> {</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='covered-line'><pre>2.33k</pre></td><td class='code'><pre> fn parse_data(&self) -> &'a [u8] {</pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='covered-line'><pre>2.33k</pre></td><td class='code'><pre> self.buffer</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='covered-line'><pre>2.33k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub(crate) trait RDataParse<'a>: Sized {</pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn parse(bytes: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RData<'a> {</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn id(&self) -> u16 {</pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.type_.id()</pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='covered-line'><pre>2.60k</pre></td><td class='code'><pre> pub fn parse(bytes: &'a [u8], i: &mut usize, type_: DnsQType) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='covered-line'><pre>2.60k</pre></td><td class='code'><pre> let len = u16::parse(bytes, i)? as usize;</pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='covered-line'><pre>2.53k</pre></td><td class='code'><pre> let pos = *i;</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='covered-line'><pre>2.53k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='covered-line'><pre>2.53k</pre></td><td class='code'><pre> if pos + len > bytes.len() {</pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='covered-line'><pre>610</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::RDataLongerThanMessage));</pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> *i += len;</pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> Ok(RData { buffer: bytes, pos, len, type_ })</pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='covered-line'><pre>2.60k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L152' href='#L152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L153' href='#L153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L154' href='#L154'><pre>154</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn write<</pre></td></tr><tr><td class='line-number'><a name='L155' href='#L155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L156' href='#L156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L157' href='#L157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L158' href='#L158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L159' href='#L159'><pre>159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>(self.len as u16).write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L160' href='#L160'><pre>160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>message.write_bytes(&self.buffer[self.pos..self.pos + self.len])</span></pre></td></tr><tr><td class='line-number'><a name='L161' href='#L161'><pre>161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L162' href='#L162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L163' href='#L163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L164' href='#L164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L165' href='#L165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.len)</pre></td></tr><tr><td class='line-number'><a name='L166' href='#L166'><pre>166</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L167' href='#L167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L168' href='#L168'><pre>168</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> pub fn into_parsed(self) -> Result<DnsAType<'a>, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L169' href='#L169'><pre>169</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> let mut pos = self.pos;</pre></td></tr><tr><td class='line-number'><a name='L170' href='#L170'><pre>170</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L171' href='#L171'><pre>171</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> Ok(match self.type_ {</pre></td></tr><tr><td class='line-number'><a name='L172' href='#L172'><pre>172</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> DnsQType::A => DnsAType::A(A::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L173' href='#L173'><pre>173</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> DnsQType::NS => DnsAType::NS(Ns::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L174' href='#L174'><pre>174</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> DnsQType::CNAME => DnsAType::CName(CName::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L175' href='#L175'><pre>175</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> DnsQType::SOA => DnsAType::Soa(Soa::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L176' href='#L176'><pre>176</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> DnsQType::PTR => DnsAType::Ptr(Ptr::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L177' href='#L177'><pre>177</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> DnsQType::HINFO => DnsAType::HInfo(HInfo::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L178' href='#L178'><pre>178</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> DnsQType::MX => DnsAType::MX(Mx::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L179' href='#L179'><pre>179</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> DnsQType::TXT => DnsAType::Txt(Txt::parse(&self, &mut pos)<span class='red'>?</span>),</pre></td></tr><tr><td class='line-number'><a name='L180' href='#L180'><pre>180</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> DnsQType::RP => DnsAType::RP(Rp::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L181' href='#L181'><pre>181</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> DnsQType::AFSDB => DnsAType::AFSDB(AfsDb::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L182' href='#L182'><pre>182</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> DnsQType::SIG => DnsAType::SIG(Sig::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L183' href='#L183'><pre>183</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> DnsQType::KEY => DnsAType::KEY(Key::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L184' href='#L184'><pre>184</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> DnsQType::AAAA => DnsAType::AAAA(Aaaa::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L185' href='#L185'><pre>185</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> DnsQType::LOC => DnsAType::Loc(Loc::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L186' href='#L186'><pre>186</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> DnsQType::SRV => DnsAType::Srv(Srv::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L187' href='#L187'><pre>187</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> DnsQType::NAPTR => DnsAType::Naptr(Naptr::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L188' href='#L188'><pre>188</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> DnsQType::KX => DnsAType::KX(Kx::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L189' href='#L189'><pre>189</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> DnsQType::CERT => DnsAType::Cert(Cert::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L190' href='#L190'><pre>190</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> DnsQType::DNAME => DnsAType::DName(DName::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L191' href='#L191'><pre>191</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> DnsQType::OPT => DnsAType::OPT(Opt::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L192' href='#L192'><pre>192</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> DnsQType::APL => DnsAType::APL(Apl::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L193' href='#L193'><pre>193</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> DnsQType::DS => DnsAType::DS(Ds::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L194' href='#L194'><pre>194</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> DnsQType::SSHFP => DnsAType::SSHFP(SshFp::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L195' href='#L195'><pre>195</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> DnsQType::IPSECKEY => DnsAType::IPSECKEY(IpSecKey::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L196' href='#L196'><pre>196</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> DnsQType::RRSIG => DnsAType::RRSIG(RRSig::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L197' href='#L197'><pre>197</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> DnsQType::NSEC => DnsAType::NSEC(Nsec::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L198' href='#L198'><pre>198</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> DnsQType::DNSKEY => DnsAType::DNSKEY(DnsKey::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L199' href='#L199'><pre>199</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> DnsQType::DHCID => DnsAType::DHCID(DhcId::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L200' href='#L200'><pre>200</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> DnsQType::NSEC3 => DnsAType::NSEC3(Nsec3::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L201' href='#L201'><pre>201</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> DnsQType::NSEC3PARAM => DnsAType::NSEC3PARAM(Nsec3Param::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L202' href='#L202'><pre>202</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> DnsQType::TLSA => DnsAType::TLSA(Tlsa::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L203' href='#L203'><pre>203</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> DnsQType::SMIMEA => DnsAType::SMIMEA(SmimeA::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L204' href='#L204'><pre>204</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> DnsQType::HIP => DnsAType::HIP(Hip::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L205' href='#L205'><pre>205</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> DnsQType::CDS => DnsAType::CDS(Cds::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L206' href='#L206'><pre>206</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> DnsQType::CDNSKEY => DnsAType::CDNSKEY(CdnsKey::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L207' href='#L207'><pre>207</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> DnsQType::OPENPGPKEY => DnsAType::OPENPGPKEY(OpenPgpKey::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L208' href='#L208'><pre>208</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> DnsQType::CSYNC => DnsAType::CSYNC(CSync::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L209' href='#L209'><pre>209</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> DnsQType::ZONEMD => DnsAType::ZONEMD(ZoneMd::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L210' href='#L210'><pre>210</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> DnsQType::SVCB => DnsAType::SVCB(Svcb::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L211' href='#L211'><pre>211</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> DnsQType::HTTPS => DnsAType::HTTPS(Https::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L212' href='#L212'><pre>212</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> DnsQType::EUI48 => DnsAType::EUI48(EUI48::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L213' href='#L213'><pre>213</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> DnsQType::EUI64 => DnsAType::EUI64(EUI64::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L214' href='#L214'><pre>214</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> DnsQType::TKEY => DnsAType::TKEY(TKey::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L215' href='#L215'><pre>215</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> DnsQType::TSIG => DnsAType::TSIG(TSig::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L216' href='#L216'><pre>216</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> DnsQType::IXFR => DnsAType::IXFR(IXfr::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L217' href='#L217'><pre>217</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> DnsQType::AXFR => DnsAType::AXFR(AXfr::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L218' href='#L218'><pre>218</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> DnsQType::ALL => return Err(DnsMessageError::DnsError(DnsError::InvalidAnswer)),</pre></td></tr><tr><td class='line-number'><a name='L219' href='#L219'><pre>219</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> DnsQType::URI => DnsAType::URI(Uri::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L220' href='#L220'><pre>220</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> DnsQType::CAA => DnsAType::CAA(Caa::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L221' href='#L221'><pre>221</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> DnsQType::TA => DnsAType::TA(Ta::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L222' href='#L222'><pre>222</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> DnsQType::DLV => DnsAType::DLV(Dlv::parse(&self, &mut pos)?),</pre></td></tr><tr><td class='line-number'><a name='L223' href='#L223'><pre>223</pre></a></td><td class='covered-line'><pre>687</pre></td><td class='code'><pre> DnsQType::Reserved => return Err(DnsMessageError::DnsError(DnsError::InvalidAnswer)),</pre></td></tr><tr><td class='line-number'><a name='L224' href='#L224'><pre>224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L225' href='#L225'><pre>225</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L226' href='#L226'><pre>226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L227' href='#L227'><pre>227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L228' href='#L228'><pre>228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(<span class='red'>D</span>ebu<span class='red'>g</span>, <span class='red'>Clone</span>, Copy, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L229' href='#L229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub enum DnsAType<'a> {</pre></td></tr><tr><td class='line-number'><a name='L230' href='#L230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> A(A),</pre></td></tr><tr><td class='line-number'><a name='L231' href='#L231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NS(Ns<'a>),</pre></td></tr><tr><td class='line-number'><a name='L232' href='#L232'><pre>232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CName(CName<'a>),</pre></td></tr><tr><td class='line-number'><a name='L233' href='#L233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Soa(Soa<'a>),</pre></td></tr><tr><td class='line-number'><a name='L234' href='#L234'><pre>234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ptr(Ptr<'a>),</pre></td></tr><tr><td class='line-number'><a name='L235' href='#L235'><pre>235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HInfo(HInfo<'a>),</pre></td></tr><tr><td class='line-number'><a name='L236' href='#L236'><pre>236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> MX(Mx<'a>),</pre></td></tr><tr><td class='line-number'><a name='L237' href='#L237'><pre>237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Txt(Txt<'a>),</pre></td></tr><tr><td class='line-number'><a name='L238' href='#L238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> RP(Rp<'a>),</pre></td></tr><tr><td class='line-number'><a name='L239' href='#L239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AFSDB(AfsDb<'a>),</pre></td></tr><tr><td class='line-number'><a name='L240' href='#L240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SIG(Sig<'a>),</pre></td></tr><tr><td class='line-number'><a name='L241' href='#L241'><pre>241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> KEY(Key<'a>),</pre></td></tr><tr><td class='line-number'><a name='L242' href='#L242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AAAA(Aaaa),</pre></td></tr><tr><td class='line-number'><a name='L243' href='#L243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Loc(Loc),</pre></td></tr><tr><td class='line-number'><a name='L244' href='#L244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Srv(Srv<'a>),</pre></td></tr><tr><td class='line-number'><a name='L245' href='#L245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Naptr(Naptr<'a>),</pre></td></tr><tr><td class='line-number'><a name='L246' href='#L246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> KX(Kx<'a>),</pre></td></tr><tr><td class='line-number'><a name='L247' href='#L247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Cert(Cert<'a>),</pre></td></tr><tr><td class='line-number'><a name='L248' href='#L248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DName(DName<'a>),</pre></td></tr><tr><td class='line-number'><a name='L249' href='#L249'><pre>249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> OPT(Opt<'a>),</pre></td></tr><tr><td class='line-number'><a name='L250' href='#L250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APL(Apl<'a>),</pre></td></tr><tr><td class='line-number'><a name='L251' href='#L251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DS(Ds<'a>),</pre></td></tr><tr><td class='line-number'><a name='L252' href='#L252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SSHFP(SshFp<'a>),</pre></td></tr><tr><td class='line-number'><a name='L253' href='#L253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IPSECKEY(IpSecKey<'a>),</pre></td></tr><tr><td class='line-number'><a name='L254' href='#L254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> RRSIG(RRSig<'a>),</pre></td></tr><tr><td class='line-number'><a name='L255' href='#L255'><pre>255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NSEC(Nsec<'a>),</pre></td></tr><tr><td class='line-number'><a name='L256' href='#L256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DNSKEY(DnsKey<'a>),</pre></td></tr><tr><td class='line-number'><a name='L257' href='#L257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DHCID(DhcId<'a>),</pre></td></tr><tr><td class='line-number'><a name='L258' href='#L258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NSEC3(Nsec3<'a>),</pre></td></tr><tr><td class='line-number'><a name='L259' href='#L259'><pre>259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NSEC3PARAM(Nsec3Param<'a>),</pre></td></tr><tr><td class='line-number'><a name='L260' href='#L260'><pre>260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TLSA(Tlsa<'a>),</pre></td></tr><tr><td class='line-number'><a name='L261' href='#L261'><pre>261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SMIMEA(SmimeA<'a>),</pre></td></tr><tr><td class='line-number'><a name='L262' href='#L262'><pre>262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HIP(Hip<'a>),</pre></td></tr><tr><td class='line-number'><a name='L263' href='#L263'><pre>263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CDS(Cds<'a>),</pre></td></tr><tr><td class='line-number'><a name='L264' href='#L264'><pre>264</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CDNSKEY(CdnsKey<'a>),</pre></td></tr><tr><td class='line-number'><a name='L265' href='#L265'><pre>265</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> OPENPGPKEY(OpenPgpKey<'a>),</pre></td></tr><tr><td class='line-number'><a name='L266' href='#L266'><pre>266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CSYNC(CSync<'a>),</pre></td></tr><tr><td class='line-number'><a name='L267' href='#L267'><pre>267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ZONEMD(ZoneMd<'a>),</pre></td></tr><tr><td class='line-number'><a name='L268' href='#L268'><pre>268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SVCB(Svcb<'a>),</pre></td></tr><tr><td class='line-number'><a name='L269' href='#L269'><pre>269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HTTPS(Https<'a>),</pre></td></tr><tr><td class='line-number'><a name='L270' href='#L270'><pre>270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> EUI48(EUI48),</pre></td></tr><tr><td class='line-number'><a name='L271' href='#L271'><pre>271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> EUI64(EUI64),</pre></td></tr><tr><td class='line-number'><a name='L272' href='#L272'><pre>272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TKEY(TKey<'a>),</pre></td></tr><tr><td class='line-number'><a name='L273' href='#L273'><pre>273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TSIG(TSig<'a>),</pre></td></tr><tr><td class='line-number'><a name='L274' href='#L274'><pre>274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IXFR(IXfr<'a>),</pre></td></tr><tr><td class='line-number'><a name='L275' href='#L275'><pre>275</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AXFR(AXfr<'a>),</pre></td></tr><tr><td class='line-number'><a name='L276' href='#L276'><pre>276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> URI(Uri<'a>),</pre></td></tr><tr><td class='line-number'><a name='L277' href='#L277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CAA(Caa<'a>),</pre></td></tr><tr><td class='line-number'><a name='L278' href='#L278'><pre>278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TA(Ta<'a>),</pre></td></tr><tr><td class='line-number'><a name='L279' href='#L279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DLV(Dlv<'a>),</pre></td></tr><tr><td class='line-number'><a name='L280' href='#L280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Unknown</pre></td></tr><tr><td class='line-number'><a name='L281' href='#L281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Reserved,</pre></td></tr><tr><td class='line-number'><a name='L282' href='#L282'><pre>282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L283' href='#L283'><pre>283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L284' href='#L284'><pre>284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Into<DnsQType> for DnsAType<'a> {</pre></td></tr><tr><td class='line-number'><a name='L285' href='#L285'><pre>285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L286' href='#L286'><pre>286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn into(self) -> DnsQType {</pre></td></tr><tr><td class='line-number'><a name='L287' href='#L287'><pre>287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> match self {</pre></td></tr><tr><td class='line-number'><a name='L288' href='#L288'><pre>288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::A(_) => DnsQType::A,</pre></td></tr><tr><td class='line-number'><a name='L289' href='#L289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::NS(_) => DnsQType::NS,</pre></td></tr><tr><td class='line-number'><a name='L290' href='#L290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CName(_) => DnsQType::CNAME,</pre></td></tr><tr><td class='line-number'><a name='L291' href='#L291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Soa(_) => DnsQType::SOA,</pre></td></tr><tr><td class='line-number'><a name='L292' href='#L292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Ptr(_) => DnsQType::PTR,</pre></td></tr><tr><td class='line-number'><a name='L293' href='#L293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::HInfo(_) => DnsQType::HINFO,</pre></td></tr><tr><td class='line-number'><a name='L294' href='#L294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::MX(_) => DnsQType::MX,</pre></td></tr><tr><td class='line-number'><a name='L295' href='#L295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Txt(_) => DnsQType::TXT,</pre></td></tr><tr><td class='line-number'><a name='L296' href='#L296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::RP(_) => DnsQType::RP,</pre></td></tr><tr><td class='line-number'><a name='L297' href='#L297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::AFSDB(_) => DnsQType::AFSDB,</pre></td></tr><tr><td class='line-number'><a name='L298' href='#L298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::SIG(_) => DnsQType::SIG,</pre></td></tr><tr><td class='line-number'><a name='L299' href='#L299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::KEY(_) => DnsQType::KEY,</pre></td></tr><tr><td class='line-number'><a name='L300' href='#L300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::AAAA(_) => DnsQType::AAAA,</pre></td></tr><tr><td class='line-number'><a name='L301' href='#L301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Loc(_) => DnsQType::LOC,</pre></td></tr><tr><td class='line-number'><a name='L302' href='#L302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Srv(_) => DnsQType::SRV,</pre></td></tr><tr><td class='line-number'><a name='L303' href='#L303'><pre>303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Naptr(_) => DnsQType::NAPTR,</pre></td></tr><tr><td class='line-number'><a name='L304' href='#L304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::KX(_) => DnsQType::KX,</pre></td></tr><tr><td class='line-number'><a name='L305' href='#L305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Cert(_) => DnsQType::CERT,</pre></td></tr><tr><td class='line-number'><a name='L306' href='#L306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DName(_) => DnsQType::DNAME,</pre></td></tr><tr><td class='line-number'><a name='L307' href='#L307'><pre>307</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::OPT(_) => DnsQType::OPT,</pre></td></tr><tr><td class='line-number'><a name='L308' href='#L308'><pre>308</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::APL(_) => DnsQType::APL,</pre></td></tr><tr><td class='line-number'><a name='L309' href='#L309'><pre>309</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DS(_) => DnsQType::DS,</pre></td></tr><tr><td class='line-number'><a name='L310' href='#L310'><pre>310</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::SSHFP(_) => DnsQType::SSHFP,</pre></td></tr><tr><td class='line-number'><a name='L311' href='#L311'><pre>311</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::IPSECKEY(_) => DnsQType::IPSECKEY,</pre></td></tr><tr><td class='line-number'><a name='L312' href='#L312'><pre>312</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::RRSIG(_) => DnsQType::RRSIG,</pre></td></tr><tr><td class='line-number'><a name='L313' href='#L313'><pre>313</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::NSEC(_) => DnsQType::NSEC,</pre></td></tr><tr><td class='line-number'><a name='L314' href='#L314'><pre>314</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DNSKEY(_) => DnsQType::DNSKEY,</pre></td></tr><tr><td class='line-number'><a name='L315' href='#L315'><pre>315</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DHCID(_) => DnsQType::DHCID,</pre></td></tr><tr><td class='line-number'><a name='L316' href='#L316'><pre>316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::NSEC3(_) => DnsQType::NSEC3,</pre></td></tr><tr><td class='line-number'><a name='L317' href='#L317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::NSEC3PARAM(_) => DnsQType::NSEC3PARAM,</pre></td></tr><tr><td class='line-number'><a name='L318' href='#L318'><pre>318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::TLSA(_) => DnsQType::TLSA,</pre></td></tr><tr><td class='line-number'><a name='L319' href='#L319'><pre>319</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::SMIMEA(_) => DnsQType::SMIMEA,</pre></td></tr><tr><td class='line-number'><a name='L320' href='#L320'><pre>320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::HIP(_) => DnsQType::HIP,</pre></td></tr><tr><td class='line-number'><a name='L321' href='#L321'><pre>321</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CDS(_) => DnsQType::CDS,</pre></td></tr><tr><td class='line-number'><a name='L322' href='#L322'><pre>322</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CDNSKEY(_) => DnsQType::CDNSKEY,</pre></td></tr><tr><td class='line-number'><a name='L323' href='#L323'><pre>323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::OPENPGPKEY(_) => DnsQType::OPENPGPKEY,</pre></td></tr><tr><td class='line-number'><a name='L324' href='#L324'><pre>324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CSYNC(_) => DnsQType::CSYNC,</pre></td></tr><tr><td class='line-number'><a name='L325' href='#L325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::ZONEMD(_) => DnsQType::ZONEMD,</pre></td></tr><tr><td class='line-number'><a name='L326' href='#L326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::SVCB(_) => DnsQType::SVCB,</pre></td></tr><tr><td class='line-number'><a name='L327' href='#L327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::HTTPS(_) => DnsQType::HTTPS,</pre></td></tr><tr><td class='line-number'><a name='L328' href='#L328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::EUI48(_) => DnsQType::EUI48,</pre></td></tr><tr><td class='line-number'><a name='L329' href='#L329'><pre>329</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::EUI64(_) => DnsQType::EUI64,</pre></td></tr><tr><td class='line-number'><a name='L330' href='#L330'><pre>330</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::TKEY(_) => DnsQType::TKEY,</pre></td></tr><tr><td class='line-number'><a name='L331' href='#L331'><pre>331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::TSIG(_) => DnsQType::TSIG,</pre></td></tr><tr><td class='line-number'><a name='L332' href='#L332'><pre>332</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::IXFR(_) => DnsQType::IXFR,</pre></td></tr><tr><td class='line-number'><a name='L333' href='#L333'><pre>333</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::AXFR(_) => DnsQType::AXFR,</pre></td></tr><tr><td class='line-number'><a name='L334' href='#L334'><pre>334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::URI(_) => DnsQType::URI,</pre></td></tr><tr><td class='line-number'><a name='L335' href='#L335'><pre>335</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CAA(_) => DnsQType::CAA,</pre></td></tr><tr><td class='line-number'><a name='L336' href='#L336'><pre>336</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::TA(_) => DnsQType::TA,</pre></td></tr><tr><td class='line-number'><a name='L337' href='#L337'><pre>337</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DLV(_) => DnsQType::DLV,</pre></td></tr><tr><td class='line-number'><a name='L338' href='#L338'><pre>338</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Reserved => DnsQType::Reserved,</pre></td></tr><tr><td class='line-number'><a name='L339' href='#L339'><pre>339</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L340' href='#L340'><pre>340</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L341' href='#L341'><pre>341</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L342' href='#L342'><pre>342</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L343' href='#L343'><pre>343</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DnsAType<'a> {</pre></td></tr><tr><td class='line-number'><a name='L344' href='#L344'><pre>344</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L345' href='#L345'><pre>345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub(crate) fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L346' href='#L346'><pre>346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L347' href='#L347'><pre>347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L348' href='#L348'><pre>348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L349' href='#L349'><pre>349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L350' href='#L350'><pre>350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> match self</span> {</pre></td></tr><tr><td class='line-number'><a name='L351' href='#L351'><pre>351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::A(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L352' href='#L352'><pre>352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::NS(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L353' href='#L353'><pre>353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::CName(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L354' href='#L354'><pre>354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::Soa(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L355' href='#L355'><pre>355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::Ptr(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L356' href='#L356'><pre>356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::HInfo(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L357' href='#L357'><pre>357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::MX(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L358' href='#L358'><pre>358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::Txt(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L359' href='#L359'><pre>359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::RP(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L360' href='#L360'><pre>360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::AFSDB(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L361' href='#L361'><pre>361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::SIG(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L362' href='#L362'><pre>362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::KEY(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L363' href='#L363'><pre>363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::AAAA(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L364' href='#L364'><pre>364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::Loc(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L365' href='#L365'><pre>365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::Srv(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L366' href='#L366'><pre>366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::Naptr(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L367' href='#L367'><pre>367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::KX(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L368' href='#L368'><pre>368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::Cert(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L369' href='#L369'><pre>369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::DName(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L370' href='#L370'><pre>370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::OPT(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L371' href='#L371'><pre>371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::APL(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L372' href='#L372'><pre>372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::DS(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L373' href='#L373'><pre>373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::SSHFP(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L374' href='#L374'><pre>374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::IPSECKEY(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L375' href='#L375'><pre>375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::RRSIG(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L376' href='#L376'><pre>376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::NSEC(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L377' href='#L377'><pre>377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::DNSKEY(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L378' href='#L378'><pre>378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::DHCID(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L379' href='#L379'><pre>379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::NSEC3(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L380' href='#L380'><pre>380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::NSEC3PARAM(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L381' href='#L381'><pre>381</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::TLSA(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L382' href='#L382'><pre>382</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::SMIMEA(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L383' href='#L383'><pre>383</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::HIP(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L384' href='#L384'><pre>384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::CDS(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L385' href='#L385'><pre>385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::CDNSKEY(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L386' href='#L386'><pre>386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::OPENPGPKEY(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L387' href='#L387'><pre>387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::CSYNC(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L388' href='#L388'><pre>388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::ZONEMD(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L389' href='#L389'><pre>389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::SVCB(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L390' href='#L390'><pre>390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::HTTPS(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L391' href='#L391'><pre>391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::EUI48(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L392' href='#L392'><pre>392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::EUI64(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L393' href='#L393'><pre>393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::TKEY(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L394' href='#L394'><pre>394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::TSIG(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L395' href='#L395'><pre>395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::IXFR(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L396' href='#L396'><pre>396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::AXFR(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L397' href='#L397'><pre>397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::URI(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L398' href='#L398'><pre>398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::CAA(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L399' href='#L399'><pre>399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::TA(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L400' href='#L400'><pre>400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::DLV(<span class='red'>r) => r.write(message)</span>,</pre></td></tr><tr><td class='line-number'><a name='L401' href='#L401'><pre>401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> DnsAType::Reserved => <span class='red'>Err(DnsMessageError::DnsError(DnsError::InvalidAnswer))</span>,</pre></td></tr><tr><td class='line-number'><a name='L402' href='#L402'><pre>402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L403' href='#L403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L404' href='#L404'><pre>404</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L405' href='#L405'><pre>405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L406' href='#L406'><pre>406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L407' href='#L407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> match self {</pre></td></tr><tr><td class='line-number'><a name='L408' href='#L408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::A(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L409' href='#L409'><pre>409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::NS(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L410' href='#L410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CName(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L411' href='#L411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Soa(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L412' href='#L412'><pre>412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Ptr(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L413' href='#L413'><pre>413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::HInfo(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L414' href='#L414'><pre>414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::MX(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L415' href='#L415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Txt(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L416' href='#L416'><pre>416</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::RP(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L417' href='#L417'><pre>417</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::AFSDB(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L418' href='#L418'><pre>418</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::SIG(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L419' href='#L419'><pre>419</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::KEY(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L420' href='#L420'><pre>420</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::AAAA(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L421' href='#L421'><pre>421</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Loc(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L422' href='#L422'><pre>422</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Srv(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L423' href='#L423'><pre>423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Naptr(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L424' href='#L424'><pre>424</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::KX(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L425' href='#L425'><pre>425</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Cert(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L426' href='#L426'><pre>426</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DName(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L427' href='#L427'><pre>427</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::OPT(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L428' href='#L428'><pre>428</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::APL(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L429' href='#L429'><pre>429</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DS(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L430' href='#L430'><pre>430</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::SSHFP(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L431' href='#L431'><pre>431</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::IPSECKEY(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L432' href='#L432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::RRSIG(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L433' href='#L433'><pre>433</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::NSEC(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L434' href='#L434'><pre>434</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DNSKEY(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L435' href='#L435'><pre>435</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DHCID(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L436' href='#L436'><pre>436</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::NSEC3(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L437' href='#L437'><pre>437</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::NSEC3PARAM(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L438' href='#L438'><pre>438</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::TLSA(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L439' href='#L439'><pre>439</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::SMIMEA(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L440' href='#L440'><pre>440</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::HIP(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L441' href='#L441'><pre>441</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CDS(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L442' href='#L442'><pre>442</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CDNSKEY(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L443' href='#L443'><pre>443</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::OPENPGPKEY(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L444' href='#L444'><pre>444</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CSYNC(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L445' href='#L445'><pre>445</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::ZONEMD(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L446' href='#L446'><pre>446</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::SVCB(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L447' href='#L447'><pre>447</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::HTTPS(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L448' href='#L448'><pre>448</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::EUI48(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L449' href='#L449'><pre>449</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::EUI64(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L450' href='#L450'><pre>450</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::TKEY(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L451' href='#L451'><pre>451</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::TSIG(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L452' href='#L452'><pre>452</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::IXFR(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L453' href='#L453'><pre>453</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::AXFR(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L454' href='#L454'><pre>454</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::URI(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L455' href='#L455'><pre>455</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::CAA(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L456' href='#L456'><pre>456</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::TA(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L457' href='#L457'><pre>457</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::DLV(r) => r.byte_len(),</pre></td></tr><tr><td class='line-number'><a name='L458' href='#L458'><pre>458</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsAType::Reserved => Ok(0),</pre></td></tr><tr><td class='line-number'><a name='L459' href='#L459'><pre>459</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L460' href='#L460'><pre>460</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L461' href='#L461'><pre>461</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L462' href='#L462'><pre>462</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L463' href='#L463'><pre>463</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn id(&self) -> u16 {</pre></td></tr><tr><td class='line-number'><a name='L464' href='#L464'><pre>464</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let qtype: DnsQType = (*self).into();</pre></td></tr><tr><td class='line-number'><a name='L465' href='#L465'><pre>465</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> qtype.id()</pre></td></tr><tr><td class='line-number'><a name='L466' href='#L466'><pre>466</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L467' href='#L467'><pre>467</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L468' href='#L468'><pre>468</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L469' href='#L469'><pre>469</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L470' href='#L470'><pre>470</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod testutils {</pre></td></tr><tr><td class='line-number'><a name='L471' href='#L471'><pre>471</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use core::fmt::Debug;</pre></td></tr><tr><td class='line-number'><a name='L472' href='#L472'><pre>472</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use arrayvec::ArrayVec;</pre></td></tr><tr><td class='line-number'><a name='L473' href='#L473'><pre>473</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::DNS_HEADER_SIZE;</pre></td></tr><tr><td class='line-number'><a name='L474' href='#L474'><pre>474</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L475' href='#L475'><pre>475</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L476' href='#L476'><pre>476</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn parse_and_compare<</pre></td></tr><tr><td class='line-number'><a name='L477' href='#L477'><pre>477</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 'a,</pre></td></tr><tr><td class='line-number'><a name='L478' href='#L478'><pre>478</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> A: RDataParse<'a> + PartialEq + Debug,</pre></td></tr><tr><td class='line-number'><a name='L479' href='#L479'><pre>479</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(bytes: &'a [u8], expected: A) {</pre></td></tr><tr><td class='line-number'><a name='L480' href='#L480'><pre>480</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut i = 0;</pre></td></tr><tr><td class='line-number'><a name='L481' href='#L481'><pre>481</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let rdata = RData {</pre></td></tr><tr><td class='line-number'><a name='L482' href='#L482'><pre>482</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> buffer: bytes,</pre></td></tr><tr><td class='line-number'><a name='L483' href='#L483'><pre>483</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pos: 0,</pre></td></tr><tr><td class='line-number'><a name='L484' href='#L484'><pre>484</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> len: bytes.len(),</pre></td></tr><tr><td class='line-number'><a name='L485' href='#L485'><pre>485</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_: DnsQType::ALL,</pre></td></tr><tr><td class='line-number'><a name='L486' href='#L486'><pre>486</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L487' href='#L487'><pre>487</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let parsed = A::parse(&rdata, &mut i).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L488' href='#L488'><pre>488</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(parsed, expected);</pre></td></tr><tr><td class='line-number'><a name='L489' href='#L489'><pre>489</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L490' href='#L490'><pre>490</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L491' href='#L491'><pre>491</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn write_and_compare<</pre></td></tr><tr><td class='line-number'><a name='L492' href='#L492'><pre>492</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const N: usize,</pre></td></tr><tr><td class='line-number'><a name='L493' href='#L493'><pre>493</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> A: WriteBytes + PartialEq + Debug,</pre></td></tr><tr><td class='line-number'><a name='L494' href='#L494'><pre>494</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(a: A, expected: &[u8; N])</pre></td></tr><tr><td class='line-number'><a name='L495' href='#L495'><pre>495</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> where</pre></td></tr><tr><td class='line-number'><a name='L496' href='#L496'><pre>496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [(); DNS_HEADER_SIZE + N]: Sized,</pre></td></tr><tr><td class='line-number'><a name='L497' href='#L497'><pre>497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L498' href='#L498'><pre>498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut message: DnsMessage<</pre></td></tr><tr><td class='line-number'><a name='L499' href='#L499'><pre>499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0, { DnsSection::Questions }, ArrayVec<u8, { DNS_HEADER_SIZE + N }></pre></td></tr><tr><td class='line-number'><a name='L500' href='#L500'><pre>500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> > = DnsMessage::new(ArrayVec::new()).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L501' href='#L501'><pre>501</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> a.write(&mut message).unwrap();</pre></td></tr><tr><td class='line-number'><a name='L502' href='#L502'><pre>502</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let buffer = message.complete().unwrap();</pre></td></tr><tr><td class='line-number'><a name='L503' href='#L503'><pre>503</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert_eq!(&buffer[DNS_HEADER_SIZE..], expected.as_slice());</pre></td></tr><tr><td class='line-number'><a name='L504' href='#L504'><pre>504</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L505' href='#L505'><pre>505</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L506' href='#L506'><pre>506</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> macro_rules! parse_write_test_macro {</pre></td></tr><tr><td class='line-number'><a name='L507' href='#L507'><pre>507</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (</pre></td></tr><tr><td class='line-number'><a name='L508' href='#L508'><pre>508</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $byte_count:literal,</pre></td></tr><tr><td class='line-number'><a name='L509' href='#L509'><pre>509</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [ $( $bytes:literal ),* $(,)? ],</pre></td></tr><tr><td class='line-number'><a name='L510' href='#L510'><pre>510</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $struct_name:ident { $( $content:ident: $content_builder:expr ),* $(,)? } $(,)?</pre></td></tr><tr><td class='line-number'><a name='L511' href='#L511'><pre>511</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ) => {</pre></td></tr><tr><td class='line-number'><a name='L512' href='#L512'><pre>512</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L513' href='#L513'><pre>513</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $byte_count,</pre></td></tr><tr><td class='line-number'><a name='L514' href='#L514'><pre>514</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [ $( $bytes ),* ],</pre></td></tr><tr><td class='line-number'><a name='L515' href='#L515'><pre>515</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $struct_name { $( $content: $content_builder ),* },</pre></td></tr><tr><td class='line-number'><a name='L516' href='#L516'><pre>516</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse,</pre></td></tr><tr><td class='line-number'><a name='L517' href='#L517'><pre>517</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> write,</pre></td></tr><tr><td class='line-number'><a name='L518' href='#L518'><pre>518</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L519' href='#L519'><pre>519</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L520' href='#L520'><pre>520</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> (</pre></td></tr><tr><td class='line-number'><a name='L521' href='#L521'><pre>521</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $byte_count:literal,</pre></td></tr><tr><td class='line-number'><a name='L522' href='#L522'><pre>522</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [ $( $bytes:literal ),* $(,)? ],</pre></td></tr><tr><td class='line-number'><a name='L523' href='#L523'><pre>523</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $struct_name:ident { $( $content:ident: $content_builder:expr ),* $(,)? },</pre></td></tr><tr><td class='line-number'><a name='L524' href='#L524'><pre>524</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $parse_name:ident,</pre></td></tr><tr><td class='line-number'><a name='L525' href='#L525'><pre>525</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $write_name:ident $(,)?</pre></td></tr><tr><td class='line-number'><a name='L526' href='#L526'><pre>526</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ) => {</pre></td></tr><tr><td class='line-number'><a name='L527' href='#L527'><pre>527</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L528' href='#L528'><pre>528</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn $parse_name() {</pre></td></tr><tr><td class='line-number'><a name='L529' href='#L529'><pre>529</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const BYTES: [u8; $byte_count] = [ $( $bytes ),* ];</pre></td></tr><tr><td class='line-number'><a name='L530' href='#L530'><pre>530</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const STRUCT: $struct_name = $struct_name {</pre></td></tr><tr><td class='line-number'><a name='L531' href='#L531'><pre>531</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $( $content: $content_builder ),*</pre></td></tr><tr><td class='line-number'><a name='L532' href='#L532'><pre>532</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L533' href='#L533'><pre>533</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L534' href='#L534'><pre>534</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> crate::rdata::testutils::parse_and_compare(&BYTES, STRUCT);</pre></td></tr><tr><td class='line-number'><a name='L535' href='#L535'><pre>535</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L536' href='#L536'><pre>536</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L537' href='#L537'><pre>537</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[test]</pre></td></tr><tr><td class='line-number'><a name='L538' href='#L538'><pre>538</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn $write_name() {</pre></td></tr><tr><td class='line-number'><a name='L539' href='#L539'><pre>539</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const BYTES: [u8; $byte_count] = [ $( $bytes ),* ];</pre></td></tr><tr><td class='line-number'><a name='L540' href='#L540'><pre>540</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const STRUCT: $struct_name = $struct_name {</pre></td></tr><tr><td class='line-number'><a name='L541' href='#L541'><pre>541</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $( $content: $content_builder ),*</pre></td></tr><tr><td class='line-number'><a name='L542' href='#L542'><pre>542</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L543' href='#L543'><pre>543</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L544' href='#L544'><pre>544</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> crate::rdata::testutils::write_and_compare(STRUCT, &BYTES);</pre></td></tr><tr><td class='line-number'><a name='L545' href='#L545'><pre>545</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L546' href='#L546'><pre>546</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L547' href='#L547'><pre>547</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L548' href='#L548'><pre>548</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L549' href='#L549'><pre>549</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) use parse_write_test_macro as parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L550' href='#L550'><pre>550</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/a.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::net::Ipv4Addr;</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # A host address</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to return a ipv4 address for a host</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct A {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The host ipv4 address</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub address: Ipv4Addr,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for A {</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> Ok(Self { address: Ipv4Addr::parse(rdata, i)? })</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for A {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.address.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl A {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4)</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 4,</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [0x01, 0x02, 0x03, 0x04],</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> A {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> address: Ipv4Addr::new(1, 2, 3, 4),</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/aaaa.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::net::Ipv6Addr;</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # IPv6 address record</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to return a IPv6 address for a host.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Aaaa {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// IPv6 address</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub address: Ipv6Addr,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Aaaa {</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> Ok(Self { address: Ipv6Addr::parse(rdata, i)? })</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for Aaaa {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.address.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl Aaaa {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(16)</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 16,</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Aaaa {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> address: Ipv6Addr::new(</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0102, 0x0304,</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0102, 0x0304,</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0102, 0x0304,</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0102, 0x0304,</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> )</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/afsdb.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # AFS data base location</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to locate a server that has a copy of the named AFS cell's database.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct AfsDb<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The subtype of the record</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> subtype: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The hostname of the server</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> hostname: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for AfsDb<'a> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> let subtype = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> let hostname = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> subtype,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> hostname,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for AfsDb<'a> {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.subtype.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.hostname.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> AfsDb<'a> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(2 + self.hostname.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 9,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // subtype</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'f', b'o', b'o', 0x01, b'b', // hostname</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // null terminator</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AfsDb {</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> subtype: 1,</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> hostname: unsafe { DnsName::from_bytes_unchecked(b"\x03foo\x01b\x00") },</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/apl.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsError, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::{Parse, ParseData};</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Address prefix list record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store a list of address prefixes.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Apl<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The address family for the prefix.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub address_family: u8,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The prefix length.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub prefix: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The negation flag.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub negation: bool,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The address family specific data.</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub data: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Apl<'a> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> let bytes = rdata.parse_data();</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> let address_family = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> let prefix = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> let length = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> let negation = length & 0x80 != 0;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> let length = length & 0x7F;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> if bytes.len() < *i + length as usize {</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return Err(DnsMessageError::DnsError(DnsError::UnexpectedEndOfBuffer));</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> let data = Characters::new(&rdata.buffer[*i..*i + length as usize])<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> address_family,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> prefix,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> negation,</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> data,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Apl<'a> {</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.address_family.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.prefix.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> let <span class='red'>mut length = self.data.as_ref().len() as u8;</span></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.negation</span> <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> length |= 0x80;</span></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>length.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>message.write_bytes(self.data.as_ref())</span></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Apl<'a> {</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(3 + self.data.as_ref().len())</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 6,</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, // address family</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x02, // prefix</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, // data</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Apl {</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> address_family: 0x01,</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> prefix: 0x02,</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> negation: false,</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: unsafe { Characters::new_unchecked(&[0x01, 0x02, 0x03]) },</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 6,</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, // address family</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x02, // prefix</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x83, // length</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, // data</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Apl {</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> address_family: 0x01,</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> prefix: 0x02,</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> negation: true,</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: unsafe { Characters::new_unchecked(&[0x01, 0x02, 0x03]) },</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_negation,</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> write_negation,</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/axfr.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Authoritative zone transfer record (AXFR)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to transfer an entire zone from a primary server to a</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// secondary server.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct AXfr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The domain name of the name server that was the</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// original or primary source of data for this zone</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub mname: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A domain name which specifies the mailbox of the</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// person responsible for this zone</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub rname: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The unsigned 32 bit version number of the original copy</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// of the zone. Zone transfers preserve this value. This</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// value wraps and should be compared using sequence space</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// arithmetic</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub serial: u32,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time interval before the zone should be</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// refreshed</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub refresh: u32,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time interval that should elapse before a</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// failed refresh should be retried</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub retry: u32,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time value that specifies the upper limit on</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the time interval that can elapse before the zone is no</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// longer authoritative</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub expire: u32,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The unsigned 32 bit minimum TTL field that should be</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// exported with any RR from this zone</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub minimum: u32,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for AXfr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> let mname = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> let rname = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> let serial = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> let refresh = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> let retry = u32::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> let expire = u32::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> let minimum = u32::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> mname,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> rname,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> serial,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> refresh,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> retry,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> expire,</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> minimum,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for AXfr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.mname.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rname.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.serial.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.refresh.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.retry.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.expire.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.minimum.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> AXfr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.mname.byte_len()? + self.rname.byte_len()? + 20)</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 45,</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e', 0x03, b'c', b'o', b'm', 0x00, // example.com</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x06, b'g', b'o', b'o', b'g', b'l', b'e', 0x03, b'c', b'o', b'm', 0x00, // google.com</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x01, // Serial</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x02, // Refresh</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x03, // Retry</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x04, // Expire</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x05, // Minimum</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AXfr {</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mname: unsafe { DnsName::from_bytes_unchecked(b"\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> rname: unsafe { DnsName::from_bytes_unchecked(b"\x06google\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> serial: 1,</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> refresh: 2,</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> retry: 3,</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> expire: 4,</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> minimum: 5,</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/caa.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Certificate authority authorization record (CAA)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to specify which certificate authorities (CAs) are</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// allowed to issue certificates for a domain.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Caa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The flags field is used to specify critical CAA flags.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: u8,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The tag field is used to specify the property represented by the record.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub tag: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The value field is used to specify the value of the property.</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub value: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Caa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> let flags = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> let tag = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> let value = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> tag,</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> value,</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Caa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.tag.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.value.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Caa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(1 + self.tag.byte_len()? + self.value.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 23,</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x42, // flags</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x05, // tag length</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'i', b's', b's', b'u', b'e', // tag</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0f, // value length</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', b'.', b'e', b'x', b'a', b'm', b'p', b'l', b'e', b't',</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'e', b's', b't', // value</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Caa {</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: 0x42,</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> tag: unsafe { Characters::new_unchecked(b"issue") },</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> value: unsafe { Characters::new_unchecked(b"www.exampletest") },</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/cdnskey.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Child DNS Key (CDNSKEY) Record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct CdnsKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The flags field specifies various flags that control the security</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// related aspects of the key.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The protocol field specifies the protocol for which the key is used.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub protocol: u8,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm field specifies the public key's cryptographic algorithm</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The public key field holds the public key material.</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub public_key: Characters<'a></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for CdnsKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> let flags = u16::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> let protocol = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> let public_key = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> protocol,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> public_key</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for CdnsKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.protocol.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.public_key.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> CdnsKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.public_key.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 5,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, // flags</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // protocol</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x04, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // public key</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CdnsKey {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: 0x0102,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> protocol: 0x03,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 0x04,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> public_key: unsafe { Characters::new_unchecked(&[]) },</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/cds.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Child Delegation Signer (CDS) Record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to publish the key tag, algorithm, and digest type</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// used in the DS record of a child zone.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Cds<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The key tag of the key that is being published.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub key_tag: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm of the key that is being published.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The digest type of the key that is being published.</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The digest of the key that is being published.</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Cds<'a> {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> let key_tag = u16::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> let digest_type = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> let digest = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> key_tag,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> digest_type,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> digest,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Cds<'a> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.key_tag.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Cds<'a> {</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.digest.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 5,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [ 0x00, 0x01, 0x08, 0x01, 0x00 ],</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Cds {</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> key_tag: 1,</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 8,</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest_type: 1,</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest: unsafe { Characters::new_unchecked(&[]) },</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/cert.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Certificate record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record lists the certificates used by the owner of the domain</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// name to sign other records in the zone.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Cert<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The type of certificate.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub cert_type: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The key tag of the certificate.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub key_tag: u16,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm used to sign the certificate.</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The certificate data.</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub certificate: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Cert<'a> {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> let cert_type = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> let key_tag = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> let certificate = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> cert_type,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> key_tag,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> certificate,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Cert<'a> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.cert_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.key_tag.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.certificate.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Cert<'a> {</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(5 + self.certificate.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 6,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, // cert type</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x02, 0x03, // key tag</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x04, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // certificate length</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Cert {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cert_type: 1,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> key_tag: 0x0203,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 4,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> certificate: unsafe { Characters::new_unchecked(&[]) },</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/cname.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # The canonical name for an alias</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to return a canonical name for an alias</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct CName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The canonical name for the alias</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for CName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> name: DnsName::parse(rdata.buffer, i)?,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for CName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.name.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> CName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.name.byte_len()</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 14,</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 4, b't', b'e', b's', b't',</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CName {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x04test\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/csync.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Child-to-Parent Synchronization (CSYNC) Record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record type is used to publish the synchronization state of a child zone to its parent zone.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct CSync<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// serial is the serial number of the zone</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub serial: u32,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// flags is a bitmap of flags (see [RFC 7477](https://tools.ietf.org/html/rfc7477))</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: u16,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// type_bit_maps is the set of RRset types present at the next owner name in the zone</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub type_bit_maps: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for CSync<'a> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> let serial = u32::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> let flags = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> let type_bit_maps = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> serial,</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> type_bit_maps</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for CSync<'a> {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.serial.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.type_bit_maps.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> CSync<'a> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(6 + self.type_bit_maps.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 10,</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x01, 0x02, 0x03, // serial</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x10, 0x01, // flags</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'w', b'w', b'w', // type_bit_maps</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CSync {</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> serial: 0x00010203,</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: 0x1001,</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_bit_maps: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/dhcid.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Dynamic host configuration protocol record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store DHCP information.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DhcId<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The identifier type.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub type_: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The digest type.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The digest of the DHCP information.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for DhcId<'a> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> let type_ = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> let digest_type = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> let digest = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> type_,</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> digest_type,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> digest,</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for DhcId<'a> {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.type_.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DhcId<'a> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(3 + self.digest.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 7,</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // type</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // digest type</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // digest len</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // digest</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DhcId {</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_: 14,</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest_type: 3,</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/dlv.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # DNSSEC lookaside validation record (DLV)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to publish the public key of a DNSSEC lookaside validation</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (DLV) trust anchor.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Dlv<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// key_tag is a mechanism for quickly identifying the signing key in a zone</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub key_tag: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// algorithm is the algorithm of the key</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// digest_type is the algorithm used to construct the digest</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// digest is the digest of the public key</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Dlv<'a> {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let key_tag = u16::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let digest_type = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let digest = Characters::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> key_tag,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> digest_type,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> digest,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Dlv<'a> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.key_tag.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Dlv<'a> {</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.digest.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 8,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // key_tag</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // digest_type</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // digest len</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // digest</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Dlv {</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> key_tag: 14,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 3,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest_type: 3,</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/dname.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Delegation name record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to delegate a DNS zone to use the given authoritative</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// name servers.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The name of the delegated domain.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for DName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> let name = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> name,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for DName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.name.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DName<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> self.name.byte_len()</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 17,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00,</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DName {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/dnskey.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # DNS key record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store public keys that are associated with a zone.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct DnsKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The flags field specifies various flags that control the security</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// related aspects of the key.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The protocol field specifies the protocol for which the key is used.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub protocol: u8,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm field specifies the public key's cryptographic algorithm</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The public key field holds the public key material.</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub public_key: Characters<'a></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for DnsKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let flags = u16::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let protocol = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let public_key = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Ok(DnsKey {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> protocol,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> public_key</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for DnsKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.protocol.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.public_key.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> DnsKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.public_key.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 8,</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0f, 0x0e, // flags</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x5c, // protocol</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x8a, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // public key length</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // public key</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> DnsKey {</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: 0x0f0e,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> protocol: 0x5c,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 0x8a,</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> public_key: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/ds.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Delegation signer record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store a cryptographic hash of a DNSKEY record.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Ds<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The key tag of the DNSKEY record.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub key_tag: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm of the DNSKEY record.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The digest type of the DNSKEY record.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The digest of the DNSKEY record.</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Ds<'a> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> let key_tag = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> let digest_type = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> let digest = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Ok(Ds {</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> key_tag,</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> digest_type,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> digest,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Ds<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.key_tag.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Ds<'a> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.digest.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 8,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0c, 0x07, // key tag</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x83, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x73, // digest type</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // digest len</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // digest</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ds {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> key_tag: 0x0c07,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 0x83,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest_type: 0x73,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/eui48.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # MAC address record (EUI-48)</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to translate between a 48-bit MAC address used by the</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// IEEE 802 protocol family and a fully qualified domain name.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct EUI48 {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// mac_address is the MAC address</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub mac_address: [u8; 6],</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for EUI48 {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let mac_address = <[u8; 6]>::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> mac_address,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for EUI48 {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.mac_address.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl EUI48 {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(6)</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 6,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> EUI48 {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mac_address: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06],</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/eui64.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # MAC address record (EUI-64)</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to translate between a 64-bit MAC address used by the</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// IEEE 802 protocol family and a fully qualified domain name.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct EUI64 {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// mac_address is the MAC address</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub mac_address: [u8; 8],</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for EUI64 {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let mac_address = <[u8; 8]>::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> mac_address,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for EUI64 {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.mac_address.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl EUI64 {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(8)</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 8,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, 0x08,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> EUI64 {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mac_address: [</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/hinfo.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Host information</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to return host information</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct HInfo<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The CPU type</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cpu: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The OS type</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> os: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for HInfo<'a> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> let cpu = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> let os = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> cpu,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> os,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for HInfo<'a> {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.cpu.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.os.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> HInfo<'a> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.cpu.byte_len()? + self.os.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 8,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> HInfo {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cpu: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> os: unsafe { Characters::new_unchecked(b"com") },</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/hip.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Host identity protocol (HIP) Record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to associate a HIP public key with a domain name.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Hip<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The usage field is an 8-bit value that defines the semantics of the</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// certificate association data field.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub usage: u8,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The selector field is an 8-bit value that defines the type of data in the</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// certificate association data field.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub selector: u8,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The matching type field is an 8-bit value that defines the semantics of</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the certificate association data field.</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub matching_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The certificate association data field is a variable-length string of octets</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// that contains the certificate association data.</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub certificate_association_data: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Hip<'a> {</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> let usage = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let selector = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let matching_type = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let certificate_association_data = Characters::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> usage,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> selector,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> matching_type,</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> certificate_association_data,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Hip<'a> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.usage.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.selector.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.matching_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.certificate_association_data.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Hip<'a> {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(3 + self.certificate_association_data.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 7,</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0e, // usage</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x63, // selector</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x43, // matching type</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // digest len</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // digest</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Hip {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> usage: 14,</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> selector: 99,</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> matching_type: 67,</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> certificate_association_data: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/https.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # HTTPs certificate record (HTTPS)</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to describe the parameters of a service binding.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Https<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The priority of this target host</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub priority: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The relative weight for entries with the same priority</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub weight: u16,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The TCP or UDP port on which the service is to be found</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub port: u16,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The domain name of the target host</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub target: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The parameters of the service binding</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub parameters: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Https<'a> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let priority = u16::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let weight = u16::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let port = u16::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let target = DnsName::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let parameters = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> priority,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> weight,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> port,</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> target,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> parameters</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Https<'a> {</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.priority.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.weight.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.port.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.target.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.parameters.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Https<'a> {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(6 + self.target.byte_len()? + self.parameters.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 15,</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // priority</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // weight</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // port</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of "www"</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // end of name</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of "www"</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Https {</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> priority: 14,</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> weight: 14,</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> port: 14,</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> target: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x00") },</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parameters: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/ipseckey.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # IPsec key record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store a public key that is associated with a domain name.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct IpSecKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The precedence of the key.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub precedence: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The gateway type.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub gateway_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm used for the key.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The gateway data.</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub gateway: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The public key data.</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub public_key: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for IpSecKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> let precedence = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> let gateway_type = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>31</pre></td><td class='code'><pre> let gateway = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> let public_key = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> precedence,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> gateway_type,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> gateway,</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> public_key,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for IpSecKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.precedence.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.gateway_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.gateway.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.public_key.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> IpSecKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.gateway.byte_len()? + self.public_key.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 12,</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, // precedence</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // gateway type</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x04, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // gateway</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // public key</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IpSecKey {</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> precedence: 0x0102,</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> gateway_type: 0x03,</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 0x04,</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> gateway: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> public_key: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/ixfr.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Incremental zone transfer record (IXFR)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to transfer a portion of a zone from a primary server to</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// a secondary server.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct IXfr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The domain name of the name server that was the</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// original or primary source of data for this zone</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub mname: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A domain name which specifies the mailbox of the</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// person responsible for this zone</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub rname: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The unsigned 32 bit version number of the original copy</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// of the zone. Zone transfers preserve this value. This</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// value wraps and should be compared using sequence space</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// arithmetic</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub serial: u32,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time interval before the zone should be</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// refreshed</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub refresh: u32,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time interval that should elapse before a</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// failed refresh should be retried</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub retry: u32,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time value that specifies the upper limit on</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the time interval that can elapse before the zone is no</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// longer authoritative</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub expire: u32,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The unsigned 32 bit minimum TTL field that should be</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// exported with any RR from this zone</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub minimum: u32,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for IXfr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> let mname = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> let rname = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> let serial = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let refresh = u32::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let retry = u32::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let expire = u32::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> let minimum = u32::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> mname,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> rname,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> serial,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> refresh,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> retry,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> expire,</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> minimum,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for IXfr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.mname.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rname.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.serial.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.refresh.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.retry.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.expire.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.minimum.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> IXfr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.mname.byte_len()? + self.rname.byte_len()? + 20)</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 53,</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 7, b'e', b'x', b'a', b'm', b'p', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0,</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 6, b'g', b'o', b'o', b'g', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 3, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0,</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x01,</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x0E, 0x10,</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x03, 0x84,</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x09, 0x3A, 0x80,</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x03, 0x84,</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> IXfr {</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mname: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> rname: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x06google\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> serial: 1,</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> refresh: 3600,</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> retry: 900,</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> expire: 604800,</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> minimum: 900,</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/key.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Key</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store a public key that can be used to verify DNSSEC signatures</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Key<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The flags field is used to store flags specific to the algorithm</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The protocol field is used to store the protocol number for which this key is used</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub protocol: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm field is used to store the algorithm number for this key</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The public key is stored as a character string</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub public_key: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Key<'a> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> let flags = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> let protocol = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> let public_key = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> protocol,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> public_key,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Key<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.protocol.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.public_key.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Key<'a> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.public_key.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 8,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // flags</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0xc4, // protocol</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x4c, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Key {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: 14,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> protocol: 196,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 76,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> public_key: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/kx.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L11'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Key exchange delegation record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record describes a mechanism whereby authorization for one node</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// to act as a key exchange for another is delegated and made available</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// with the secure DNS protocol.</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Kx<'a> {</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The preference given to this record among others at the same owner.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub preference: u16,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The key exchange host name.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub exchange: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Kx<'a> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let preference = u16::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let exchange = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> preference,</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> exchange,</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Kx<'a> {</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.preference.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.exchange.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Kx<'a> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(2 + self.exchange.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 7,</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // preference</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', 0x00, // exchange</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Kx {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> preference: 14,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> exchange: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x00") },</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/loc.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L8'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Location information</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to return a location for a host</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Loc {</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The version of the location record</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub version: u8,</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The size of the location record</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub size: u8,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The horizontal precision of the location record</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub horizontal_precision: u8,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The vertical precision of the location record</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub vertical_precision: u8,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The latitude of the location record</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub latitude: u32,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The longitude of the location record</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub longitude: u32,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The altitude of the location record</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub altitude: u32,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Loc {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> let version = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> let size = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> let horizontal_precision = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> let vertical_precision = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> let latitude = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> let longitude = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> let altitude = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> version,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> size,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> horizontal_precision,</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> vertical_precision,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> latitude,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> longitude,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> altitude,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for Loc {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.version.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.size.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.horizontal_precision.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.vertical_precision.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.latitude.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.longitude.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.altitude.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl Loc {</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(16)</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 16,</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0e, // version</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0d, // size</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0c, // horizontal precision</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0b, // vertical precision</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0a, // latitude</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0b, // longitude</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0c, // altitude</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Loc {</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> version: 0x0e,</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> size: 0x0d,</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> horizontal_precision: 0x0c,</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> vertical_precision: 0x0b,</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> latitude: 0x0a,</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> longitude: 0x0b,</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> altitude: 0x0c,</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/mx.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Mail exchange</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to specify the mail exchange for a domain name.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Mx<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The preference of this mail exchange</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub preference: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The domain name of the mail exchange</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub exchange: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Mx<'a> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> let preference = u16::parse(rdata.buffer, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> let exchange = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> preference,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> exchange,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Mx<'a> {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.preference.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.exchange.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Mx<'a> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(2 + self.exchange.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 7,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // preference</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', 0x00, // exchange</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Mx {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> preference: 14,</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> exchange: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x00") },</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/naptr.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Naming authority pointer</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to delegate a DNS zone to use the given authoritative name servers</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Naptr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The order in which the NAPTR records MUST be processed in order to accurately represent the ordered list of Rules.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub order: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The preference value of this NAPTR record.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub preference: u16,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The flags field specifies various flags that control the processing of the NAPTR record.</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The service field specifies the service(s) available down this rewrite path.</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub service: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The regexp field specifies a substitution expression that is applied to the original string held by the client in order to construct the next domain name to lookup.</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub regexp: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The replacement field specifies the next domain-name to query for NAPTR, SRV, or Address records depending on the value of the flags field.</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub replacement: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Naptr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> let order = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> let preference = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> let flags = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> let service = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> let regexp = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> let replacement = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> order,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> preference,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> service,</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> regexp,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> replacement,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Naptr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.order.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.preference.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.service.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.regexp.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.replacement.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Naptr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.flags.byte_len()? + self.service.byte_len()? + self.regexp.byte_len()? + self.replacement.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 21,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // order</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0f, // preference</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'a', b'b', b'c', // flags</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'd', b'e', b'f', // service</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'g', b'h', b'i', // regexp</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'j', b'k', b'l', 0x00, // replacement</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Naptr {</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> order: 14,</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> preference: 15,</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: unsafe { Characters::new_unchecked(b"abc") },</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> service: unsafe { Characters::new_unchecked(b"def") },</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> regexp: unsafe { Characters::new_unchecked(b"ghi") },</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> replacement: unsafe { DnsName::from_bytes_unchecked(b"\x03jkl\x00") },</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/ns.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # An authoritative name server</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// this record is used to return a nameserver for the given domain</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Ns<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The name server for the domain</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Ns<'a> {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> let name = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> name,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Ns<'a> {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.name.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Ns<'a> {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.name.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 17,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ns {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/nsec.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Next secure record</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to prove that a name does not exist in a zone.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Nsec<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The next owner name in the canonical ordering of the zone.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub next_domain_name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The set of RR types present at the NSEC RR's owner name.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub type_bit_maps: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Nsec<'a> {</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> let next_domain_name = DnsName::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> let type_bit_maps = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> next_domain_name,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> type_bit_maps,</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Nsec<'a> {</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.next_domain_name.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.type_bit_maps.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Nsec<'a> {</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.next_domain_name.byte_len()? + self.type_bit_maps.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 9,</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of "www"</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // end of name</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of "www"</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Nsec {</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> next_domain_name: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x00") },</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_bit_maps: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/nsec3.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Next secure record version 3</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to provide authenticated denial of existence for DNSSEC.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Nsec3<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The hash algorithm used to hash the original owner name field.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub hash_algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The flags field.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The number of iterations used to construct the hash.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub iterations: u16,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The salt used to construct the hash.</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub salt: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The next hashed owner name in the canonical ordering of the zone.</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub next_hashed_owner_name: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The type bit maps field.</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub type_bit_maps: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Nsec3<'a> {</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> let hash_algorithm = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> let flags = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> let iterations = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> let salt = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> let next_hashed_owner_name = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> let type_bit_maps = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> hash_algorithm,</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> iterations,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> salt,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> next_hashed_owner_name,</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> type_bit_maps,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Nsec3<'a> {</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.hash_algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.iterations.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.salt.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.next_hashed_owner_name.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.type_bit_maps.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Nsec3<'a> {</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(5 + self.salt.byte_len()? + self.next_hashed_owner_name.byte_len()? + self.type_bit_maps.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 16,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0e, // hash algorithm</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0a, // flags</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // iterations</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of salt</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'a', b'b', b'c',</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of next hashed owner name</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'd', b'e', b'f',</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of type bit maps</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Nsec3 {</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> hash_algorithm: 0x0e,</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: 0x0a,</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> iterations: 0x000e,</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> salt: unsafe { Characters::new_unchecked(b"abc") },</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> next_hashed_owner_name: unsafe { Characters::new_unchecked(b"def") },</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_bit_maps: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/nsec3param.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Next secure record version 3 parameters</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to provide parameters for the NSEC3 records.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Nsec3Param<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Hash algorithm</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub hash_algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Flags</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Iterations</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub iterations: u16,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Salt</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub salt: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Nsec3Param<'a> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> let hash_algorithm = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> let flags = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> let iterations = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> let salt = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> hash_algorithm,</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> iterations,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> salt,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Nsec3Param<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.hash_algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.iterations.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.salt.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Nsec3Param<'a> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.salt.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 8,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0e, // hash algorithm</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0xae, // flags</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0a, 0xfe, // iterations</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // salt</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Nsec3Param {</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> hash_algorithm: 0x0e,</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: 0xae,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> iterations: 0x0afe,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> salt: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/openpgpkey.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L12'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # OpenPGP Key Record (OPENPGPKEY)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used as part of the DNS-Based Authentication of Named</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Entities (DANE) protocol to associate a public key with a domain name.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The OPENPGPKEY record is intended to be used in conjunction with the</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// TLSA record [RFC6698].</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct OpenPgpKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// flags is a bitmap of flags (see [RFC 4880](https://tools.ietf.org/html/rfc4880))</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub flags: u16,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// algorithm is the algorithm of the public key</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// public_key is the public key</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub public_key: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// fingerprint is the fingerprint of the referenced public key</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fingerprint: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for OpenPgpKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> let flags = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> let public_key = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> let fingerprint = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> flags,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> public_key,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> fingerprint</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for OpenPgpKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.flags.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.public_key.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.fingerprint.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> OpenPgpKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(3 + self.public_key.byte_len()? + self.fingerprint.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 11,</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // flags</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0a, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // public key</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // fingerprint</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> OpenPgpKey {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> flags: 0x000e,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 0x0a,</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> public_key: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fingerprint: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/opt.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Option record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store options for the DNS protocol.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Opt<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The code for the option.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub code: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The data for the option.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub data: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Opt<'a> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> let code = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> let data = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> code,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> data,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Opt<'a> {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.code.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.data.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Opt<'a> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(2 + self.data.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 6,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // code</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // data</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Opt {</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> code: 14,</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/ptr.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # A domain name pointer</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to return a canonical name for an alias</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Ptr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The canonical name for the alias</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Ptr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> let name = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> name,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Ptr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.name.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Ptr<'a> {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.name.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 17,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ptr {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> name: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/rp.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Responsible person</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to identify the responsible person for a domain</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Rp<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The mailbox name of the responsible person</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub mbox: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The domain name of the responsible person</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub txt: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Rp<'a> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> let mbox = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> let txt = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> mbox,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> txt,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Rp<'a> {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.mbox.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.txt.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Rp<'a> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.mbox.byte_len()? + self.txt.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 33,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // mbox</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x06, b'g', b'o', b'o', b'g', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // txt</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Rp {</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mbox: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> txt: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x06google\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/rrsig.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L11'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # DNSSEC signature record</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to sign other records. It is used in conjunction with the</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// DnsKey record to verify the authenticity of a record.</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct RRSig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The type of record that is covered by this signature.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub type_covered: u16,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm used to create the signature.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The number of seconds the signature is valid for.</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub original_ttl: u32,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The time at which the signature was created.</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub signature_expiration: u32,</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The time at which the signature was last refreshed.</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub signature_inception: u32,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The key tag of the key that was used to create the signature.</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub key_tag: u16,</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The name of the zone that this signature was created for.</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub signer_name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The signature.</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub signature: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for RRSig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> let type_covered = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> let original_ttl = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> let signature_expiration = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> let signature_inception = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> let key_tag = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> let signer_name = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> let signature = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> type_covered,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> original_ttl,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> signature_expiration,</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> signature_inception,</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> key_tag,</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> signer_name,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> signature,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for RRSig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.type_covered.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.original_ttl.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.signature_expiration.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.signature_inception.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.key_tag.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.signer_name.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.signature.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RRSig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(18 + self.signer_name.byte_len()? + self.signature.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 42,</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // type covered</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x05, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0a, // original ttl</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0b, // signature expiration</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0c, // signature inception</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0d, // key tag</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // signer name</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'f', b'o', b'o', b'-', b'b', b'a', b'r', // signature</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> RRSig {</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_covered: 14,</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 5,</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> original_ttl: 10,</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature_expiration: 11,</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature_inception: 12,</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> key_tag: 13,</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signer_name: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature: unsafe { Characters::new_unchecked(b"foo-bar") },</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/sig.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Signature</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to authenticate the data in a message</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Sig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The type of the record covered by this signature</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_covered: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm used</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The number of labels in the original RDATA</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> labels: u8,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The original TTL</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> original_ttl: u32,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The signature expiration</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature_expiration: u32,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The signature inception</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature_inception: u32,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The key tag</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> key_tag: u16,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The signer's name</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signer_name: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The signature</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Sig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> let type_covered = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>55</pre></td><td class='code'><pre> let labels = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> let original_ttl = u32::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> let signature_expiration = u32::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> let signature_inception = u32::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> let key_tag = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> let signer_name = DnsName::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> let signature = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> type_covered,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> labels,</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> original_ttl,</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> signature_expiration,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> signature_inception,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> key_tag,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> signer_name,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> signature,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Sig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.type_covered.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.labels.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.original_ttl.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.signature_expiration.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.signature_inception.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.key_tag.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.signer_name.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.signature.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Sig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(18 + self.signer_name.byte_len()? + self.signature.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 43,</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // type covered</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x05, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x06, // labels</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0a, // original ttl</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0b, // signature expiration</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0c, // signature inception</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0d, // key tag</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // signer name</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'f', b'o', b'o', b'-', b'b', b'a', b'r', // signature</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Sig {</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type_covered: 14,</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 5,</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> labels: 6,</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> original_ttl: 10,</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature_expiration: 11,</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature_inception: 12,</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> key_tag: 13,</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signer_name: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> signature: unsafe { Characters::new_unchecked(b"foo-bar") },</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/smimea.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # S/MIME cert association record (SMIMEA)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store S/MIME certificate association</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct SmimeA<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The usage of the certificate</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub usage: u8,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The selector of the certificate</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub selector: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The matching type of the certificate</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub matching_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The certificate data</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub certificate: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for SmimeA<'a> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> let usage = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> let selector = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> let matching_type = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> let certificate = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> usage,</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> selector,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> matching_type,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> certificate,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for SmimeA<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.usage.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.selector.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.matching_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.certificate.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> SmimeA<'a> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(3 + self.certificate.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 19,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0e, // usage</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0f, // selector</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x10, // matching type</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0f, // length of certificate</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04, 0x05,</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x06, 0x07, 0x08, 0x09, 0x0a,</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, // certificate</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SmimeA {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> usage: 0x0e,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> selector: 0x0f,</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> matching_type: 0x10,</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> certificate: unsafe { Characters::new_unchecked(&[</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, 0x02, 0x03, 0x04, 0x05,</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x06, 0x07, 0x08, 0x09, 0x0a,</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ]) },</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/soa.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Marks the start of a zone of authority</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to mark the start of a zone of authority</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// and contains the parameters of the zone</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Soa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The domain name of the name server that was the</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// original or primary source of data for this zone</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub mname: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A domain name which specifies the mailbox of the</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// person responsible for this zone</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub rname: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The unsigned 32 bit version number of the original copy</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// of the zone. Zone transfers preserve this value. This</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// value wraps and should be compared using sequence space</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// arithmetic</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub serial: u32,</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time interval before the zone should be</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// refreshed</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub refresh: u32,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time interval that should elapse before a</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// failed refresh should be retried</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub retry: u32,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// A 32 bit time value that specifies the upper limit on</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the time interval that can elapse before the zone is no</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// longer authoritative</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub expire: u32,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The unsigned 32 bit minimum TTL field that should be</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// exported with any RR from this zone</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub minimum: u32,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Soa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> let mname = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> let rname = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> let serial = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> let refresh = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> let retry = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> let expire = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> let minimum = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> mname,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> rname,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> serial,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> refresh,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> retry,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> expire,</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> minimum,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Soa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.mname.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.rname.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.serial.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.refresh.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.retry.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.expire.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.minimum.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Soa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.mname.byte_len()? + self.rname.byte_len()? + 20)</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 53,</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // mname</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x06, b'g', b'o', b'o', b'g', b'l', b'e',</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'c', b'o', b'm',</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // rname</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0e, // serial</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0f, // refresh</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x10, // retry</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x11, // expire</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x12, // minimum</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Soa {</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mname: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x07example\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> rname: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x06google\x03com\x00") },</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> serial: 14,</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> refresh: 15,</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> retry: 16,</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> expire: 17,</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> minimum: 18,</pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/srv.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Service locator</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to return a service location</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Srv<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The priority of the target host</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub priority: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The weight of the target host</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub weight: u16,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The port on the target host</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub port: u16,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The target host</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub target: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Srv<'a> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> let priority = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> let weight = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> let port = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> let target = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> priority,</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> weight,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> port,</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> target,</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Srv<'a> {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.priority.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.weight.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.port.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.target.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Srv<'a> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(6 + self.target.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 11,</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // priority</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // weight</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // port</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03,</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w',</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // target</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Srv {</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> priority: 14,</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> weight: 14,</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> port: 14,</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> target: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x00") },</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/sshfp.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # SSH public key fingerprint record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to store the fingerprint of an SSH public key.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct SshFp<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm used to generate the fingerprint.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The fingerprint type.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fingerprint_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The fingerprint data.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub data: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for SshFp<'a> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> let fingerprint_type = u8::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> let data = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> fingerprint_type,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> data,</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for SshFp<'a> {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.fingerprint_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.data.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> SshFp<'a> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(2 + self.data.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 6,</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x01, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x02, // fingerprint type</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of "www"</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SshFp {</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 1,</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fingerprint_type: 2,</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/svcb.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Service binding record (SVCB)</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to describe the parameters of a service binding.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Svcb<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The priority of this target host</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub priority: u16,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The relative weight for entries with the same priority</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub weight: u16,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The TCP or UDP port on which the service is to be found</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub port: u16,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The domain name of the target host</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub target: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The parameters of the service binding</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub parameters: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Svcb<'a> {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> let priority = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>106</pre></td><td class='code'><pre> let weight = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>105</pre></td><td class='code'><pre> let port = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>104</pre></td><td class='code'><pre> let target = DnsName::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>78</pre></td><td class='code'><pre> let parameters = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> priority,</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> weight,</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> port,</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> target,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> parameters</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Svcb<'a> {</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.priority.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.weight.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.port.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.target.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.parameters.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Svcb<'a> {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(6 + self.target.byte_len()? + self.parameters.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 15,</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // priority</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // weight</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // port</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of "www"</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // end of name</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of "www"</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Svcb {</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> priority: 14,</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> weight: 14,</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> port: 14,</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> target: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x00") },</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parameters: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/ta.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # DNSSEC trust authorities record (TA)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to publish the public key of a DNSSEC trust anchor.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Ta<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// trust_anchor_link is the trust anchor link</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub trust_anchor_link: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Ta<'a> {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> let trust_anchor_link = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> trust_anchor_link,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Ta<'a> {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.trust_anchor_link.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Ta<'a> {</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.trust_anchor_link.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 4,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03,</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // trust_anchor_link</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ta {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> trust_anchor_link: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/tkey.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L10'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Transaction key record (TKEY)</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to establish a shared key between two hosts.</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct TKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The algorithm used to generate the key.</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The time the key was generated.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub inception: u32,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The time the key will expire.</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub expiration: u32,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The mode of the key.</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub mode: u16,</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The error that occurred.</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub error: u16,</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The key data.</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub key: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The other data.</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub other: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for TKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> let algorithm = DnsName::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> let inception = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> let expiration = u32::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> let mode = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> let error = u16::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>31</pre></td><td class='code'><pre> let key = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> let other = Characters::parse(rdata.buffer, i)?;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> inception,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> expiration,</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> mode,</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> error,</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> key,</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> other,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for TKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.inception.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.expiration.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.mode.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.error.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.key.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.other.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> TKey<'a> {</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.algorithm.byte_len()? + 4 + 4 + 2 + 2 + self.key.byte_len()? + self.other.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 25,</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', 0x00, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0a, // inception</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x0b, // expiration</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0c, // mode</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0d, // error</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // key</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', // other</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TKey {</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x00") },</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> inception: 10,</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> expiration: 11,</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mode: 12,</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> error: 13,</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> key: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> other: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/tlsa.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L11'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Transport Layer Security Authentication (TLSA) Record</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to associate a TLS server certificate or public key with</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the domain name where the record is found, thus forming a "TLSA certificate association".</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record type is described in [RFC 6698](https://tools.ietf.org/html/rfc6698).</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Tlsa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> usage: u8,</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> selector: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> matching_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> certificate_association_data: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Tlsa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> let usage = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> let selector = u8::parse(rdata, i)<span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> let matching_type = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> let certificate_association_data = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> usage,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> selector,</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> matching_type,</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> certificate_association_data,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Tlsa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.usage.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.selector.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.matching_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.certificate_association_data.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Tlsa<'a> {</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(3 + self.certificate_association_data.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 7,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0a, // usage</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0b, // selector</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0c, // matching type</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of certificate association data</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x77, 0x77, 0x77, // certificate association data</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Tlsa {</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> usage: 10,</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> selector: 11,</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> matching_type: 12,</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> certificate_association_data: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/tsig.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L12'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::name::DnsName;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Transaction signature record (TSIG)</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to authenticate dynamic updates as coming from an</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// approved client, and to authenticate responses as coming from an approved</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// recursive server.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct TSig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The name of the algorithm in domain name syntax.</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: DnsName<'a>,</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The time that the signature was generated.</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub time_signed: u64,</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The Fudge value is an unsigned 8-bit field that specifies the allowed</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// time difference in seconds.</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fudge: u8,</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The MAC is a variable length octet string containing the message</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// authentication code.</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub mac: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The original ID of the message.</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub original_id: u16,</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The error field is an unsigned 16-bit field that contains the extended</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// RCODE covering TSIG processing.</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub error: u16,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The other field is a variable length octet string that contains</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// information that may be used by the server to complete the transaction.</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub other: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for TSig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> let algorithm = DnsName::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> let time_signed = u64::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> let fudge = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> let mac = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> let original_id = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> let error = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> let other = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> time_signed,</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> fudge,</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> mac,</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> original_id,</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> error,</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> other,</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for TSig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.time_signed.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.fudge.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.mac.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.original_id.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.error.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.other.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> TSig<'a> {</pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.algorithm.byte_len()? + 10 + self.mac.byte_len()? + self.other.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 26,</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, b'w', b'w', b'w', 0x00, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, // time_signed</pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0b, // fudge</pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, 0x77, 0x77, 0x77, // mac</pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0c, // original_id</pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0d, // error</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, 0x77, 0x77, 0x77, // other</pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TSig {</pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: unsafe { DnsName::from_bytes_unchecked(b"\x03www\x00") },</pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> time_signed: 10,</pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fudge: 11,</pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> mac: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> original_id: 12,</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> error: 13,</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> other: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/txt.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L7'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsError, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # The txt record</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to hold arbitrary text data.</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>PartialEq</span>)]</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Txt<'a> {</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The text data</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[macro_export]</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>macro_rules! dns_txt {</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ($value:expr $(, $values:expr)* $(,)?) => {</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const TXT: [u8; { $value.len() + 1 $(+ $values.len() + 1)* }] = {</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut result = [0; $value.len() + 1 $(+ $values.len() + 1)*];</pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[0] = $value.len() as u8;</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut index = 1;</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut r_index = 0;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> loop {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if r_index == $value.len() {</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[index] = $value[r_index];</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> r_index += 1;</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> index += 1;</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> $(</pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[index] = $values.len() as u8;</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> index += 1;</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> let mut r_index = 0;</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> loop {</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if r_index == $values.len() {</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result[index] = $values[r_index];</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> r_index += 1;</pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> index += 1;</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> )*</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> result</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsafe { Txt::new_unchecked(&TXT) }</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Txt<'a> {</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> let data = &rdata.buffer[*i..*i + rdata.len];</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> *i += rdata.len;</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> data,</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Txt<'a> {</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_bytes(self.data)</span></pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Txt<'a> {</pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub fn new(data: &'a [u8]) -> Result<Self, DnsMessageError> </span>{</pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for <span class='red'>r</span> in (TxtIterator {</pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>data</span>,</pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pos: 0,</pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }) {</pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>r</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L88' href='#L88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L89' href='#L89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L90' href='#L90'><pre>90</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ok(Self {</span></pre></td></tr><tr><td class='line-number'><a name='L91' href='#L91'><pre>91</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> data,</span></pre></td></tr><tr><td class='line-number'><a name='L92' href='#L92'><pre>92</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> })</span></pre></td></tr><tr><td class='line-number'><a name='L93' href='#L93'><pre>93</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L94' href='#L94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L95' href='#L95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L96' href='#L96'><pre>96</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>pub const unsafe fn new_unchecked(data: &'a [u8]) -> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L97' href='#L97'><pre>97</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Self {</span></pre></td></tr><tr><td class='line-number'><a name='L98' href='#L98'><pre>98</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> data,</span></pre></td></tr><tr><td class='line-number'><a name='L99' href='#L99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L100' href='#L100'><pre>100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L101' href='#L101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L102' href='#L102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L103' href='#L103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub fn iter(&self) -> TxtIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L104' href='#L104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> TxtIterator {</pre></td></tr><tr><td class='line-number'><a name='L105' href='#L105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: self.data,</pre></td></tr><tr><td class='line-number'><a name='L106' href='#L106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pos: 0,</pre></td></tr><tr><td class='line-number'><a name='L107' href='#L107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L108' href='#L108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L109' href='#L109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L110' href='#L110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L111' href='#L111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L112' href='#L112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(self.data.len())</pre></td></tr><tr><td class='line-number'><a name='L113' href='#L113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L114' href='#L114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L115' href='#L115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L116' href='#L116'><pre>116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>)]</pre></td></tr><tr><td class='line-number'><a name='L117' href='#L117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct TxtIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L118' href='#L118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> data: &'a [u8],</pre></td></tr><tr><td class='line-number'><a name='L119' href='#L119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pos: usize,</pre></td></tr><tr><td class='line-number'><a name='L120' href='#L120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L121' href='#L121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L122' href='#L122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Iterator for TxtIterator<'a> {</pre></td></tr><tr><td class='line-number'><a name='L123' href='#L123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> type Item = Result<&'a [u8], DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L124' href='#L124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L125' href='#L125'><pre>125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn next(&mut self) -> Option<Self::Item> {</span></pre></td></tr><tr><td class='line-number'><a name='L126' href='#L126'><pre>126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if self.pos >= self.data.len()</span> {</pre></td></tr><tr><td class='line-number'><a name='L127' href='#L127'><pre>127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>None</span>;</pre></td></tr><tr><td class='line-number'><a name='L128' href='#L128'><pre>128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L129' href='#L129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L130' href='#L130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let len = self.data[self.pos] as usize;</span></pre></td></tr><tr><td class='line-number'><a name='L131' href='#L131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L132' href='#L132'><pre>132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if len == 0</span> && <span class='red'>self.pos + 1 == self.data.len()</span> {</pre></td></tr><tr><td class='line-number'><a name='L133' href='#L133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>None</span>;</pre></td></tr><tr><td class='line-number'><a name='L134' href='#L134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else if <span class='red'>len == 0</span> {</pre></td></tr><tr><td class='line-number'><a name='L135' href='#L135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Some(Err(DnsMessageError::DnsError(DnsError::InvalidTxtRecord)))</span>;</pre></td></tr><tr><td class='line-number'><a name='L136' href='#L136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L137' href='#L137'><pre>137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L138' href='#L138'><pre>138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.pos += 1;</span></pre></td></tr><tr><td class='line-number'><a name='L139' href='#L139'><pre>139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L140' href='#L140'><pre>140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let end = self.pos + len;</span></pre></td></tr><tr><td class='line-number'><a name='L141' href='#L141'><pre>141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L142' href='#L142'><pre>142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if end > self.data.len()</span> {</pre></td></tr><tr><td class='line-number'><a name='L143' href='#L143'><pre>143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> return <span class='red'>Some(Err(DnsMessageError::DnsError(DnsError::InvalidTxtRecord)))</span>;</pre></td></tr><tr><td class='line-number'><a name='L144' href='#L144'><pre>144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> }<span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L145' href='#L145'><pre>145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L146' href='#L146'><pre>146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> let result = &self.data[self.pos..end];</span></pre></td></tr><tr><td class='line-number'><a name='L147' href='#L147'><pre>147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> self.pos = end;</span></pre></td></tr><tr><td class='line-number'><a name='L148' href='#L148'><pre>148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L149' href='#L149'><pre>149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Some(Ok(result))</span></pre></td></tr><tr><td class='line-number'><a name='L150' href='#L150'><pre>150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L151' href='#L151'><pre>151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/uri.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Uniform resource identifier record (URI)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to publish mappings from hostnames to URIs.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct Uri<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The priority of this URI record. Lower values are preferred.</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub priority: u16,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The weight of this URI record. Higher values are preferred.</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub weight: u16,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// The target URI.</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub target: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for Uri<'a> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> let priority = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> let weight = u16::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> let target = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> priority,</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> weight,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> target,</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for Uri<'a> {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.priority.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.weight.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.target.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> Uri<'a> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(4 + self.target.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 8,</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // priority</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, 0x0e, // weight</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // length of "www"</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // "www"</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Uri {</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> priority: 14,</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> weight: 14,</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> target: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/rdata/zonemd.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L9'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::characters::Characters;</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::parse::Parse;</pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::rdata::{RData, RDataParse};</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::write::WriteBytes;</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// # Message digest for DNS zone record (ZONEMD)</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This record is used to publish a message digest for a DNS zone.</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>#[derive(Copy, <span class='red'>Clone</span>, <span class='red'>Debug</span>, <span class='red'>P</span>artialE<span class='red'>q</span>)]</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub struct ZoneMd<'a> {</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// algorithm is the algorithm of the digest</pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub algorithm: u8,</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// digest_type is the algorithm used to construct the digest</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest_type: u8,</pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// digest is the digest of the zone</pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub digest: Characters<'a>,</pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> RDataParse<'a> for ZoneMd<'a> {</pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> fn parse(rdata: &RData<'a>, i: &mut usize) -> Result<Self, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> let algorithm = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> let digest_type = u8::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> let digest = Characters::parse(rdata, i)?;</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Ok(Self {</pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> algorithm,</pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> digest_type,</pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> digest</pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> })</pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> WriteBytes for ZoneMd<'a> {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.algorithm.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest_type.write(message)</span><span class='red'>?</span>;</pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>self.digest.write(message)</span></pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<'a> ZoneMd<'a> {</pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> pub(crate) fn byte_len(&self) -> Result<usize, DnsMessageError> {</pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Ok(2 + self.digest.byte_len()?)</pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#[cfg(test)]</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>mod test {</pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use crate::rdata::testutils::parse_write_test;</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> use super::*;</pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> parse_write_test!(</pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 6,</pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> [</pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x0e, // algorithm</pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x00, // digest_type</pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> 0x03, // digest length</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> b'w', b'w', b'w', // digest</pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ],</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ZoneMd {</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> algorithm: 14,</pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest_type: 0,</pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> digest: unsafe { Characters::new_unchecked(b"www") },</pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> },</pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> );</pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html><!doctype html><html><head><meta name='viewport' content='width=device-width,initial-scale=1'><meta charset='UTF-8'><style>.red { background-color: #ffd0d0; } .cyan { background-color: cyan; } body { font-family: -apple-system, sans-serif; } pre { margin-top: 0px !important; margin-bottom: 0px !important; } .source-name-title { padding: 5px 10px; border-bottom: 1px solid #dbdbdb; background-color: #eee; line-height: 35px; } .centered { display: table; margin-left: left; margin-right: auto; border: 1px solid #dbdbdb; border-radius: 3px; } .expansion-view { background-color: rgba(0, 0, 0, 0); margin-left: 0px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #dbdbdb; border-radius: 3px; } table { border-collapse: collapse; } .light-row { background: #ffffff; border: 1px solid #dbdbdb; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; font-weight: bold; } .column-entry { text-align: left; } .column-entry-bold { font-weight: bold; text-align: left; } .column-entry-yellow { text-align: left; background-color: #ffffd0; } .column-entry-yellow:hover { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } .column-entry-red:hover { background-color: #fff0f0; } .column-entry-green { text-align: left; background-color: #d0ffd0; } .column-entry-green:hover { background-color: #f0fff0; } .line-number { text-align: right; color: #aaa; } .covered-line { text-align: right; color: #0080ff; } .uncovered-line { text-align: right; color: #ff3300; } .tooltip { position: relative; display: inline; background-color: #b3e6ff; text-decoration: none; } .tooltip span.tooltip-content { position: absolute; width: 100px; margin-left: -50px; color: #FFFFFF; background: #000000; height: 30px; line-height: 30px; text-align: center; visibility: hidden; border-radius: 6px; } .tooltip span.tooltip-content:after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-top: 8px solid #000000; border-right: 8px solid transparent; border-left: 8px solid transparent; } :hover.tooltip span.tooltip-content { visibility: visible; opacity: 0.8; bottom: 30px; left: 50%; z-index: 999; } th, td { vertical-align: top; padding: 2px 8px; border-collapse: collapse; border-right: solid 1px #eee; border-left: solid 1px #eee; text-align: left; } td pre { display: inline-block; } td:first-child { border-left: none; } td:last-child { border-right: none; } tr:hover { background-color: #f0f0f0; } </style></head><body><div class='centered'><table><div class='source-name-title'><pre>/mnt/h/flex-dns/src/write.rs</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L14'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L1' href='#L1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use core::net::{Ipv4Addr, Ipv6Addr};</pre></td></tr><tr><td class='line-number'><a name='L2' href='#L2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>use crate::{Buffer, DnsMessage, DnsMessageError, DnsSection};</pre></td></tr><tr><td class='line-number'><a name='L3' href='#L3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>pub(crate) trait WriteBytes {</pre></td></tr><tr><td class='line-number'><a name='L5' href='#L5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> fn write<</pre></td></tr><tr><td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const PTR_STORAGE: usize,</pre></td></tr><tr><td class='line-number'><a name='L7' href='#L7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DNS_SECTION: DnsSection,</pre></td></tr><tr><td class='line-number'><a name='L8' href='#L8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> B: Buffer,</pre></td></tr><tr><td class='line-number'><a name='L9' href='#L9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError>;</pre></td></tr><tr><td class='line-number'><a name='L10' href='#L10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L11' href='#L11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L12' href='#L12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for u8 {</pre></td></tr><tr><td class='line-number'><a name='L13' href='#L13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L14' href='#L14'><pre>14</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L15' href='#L15'><pre>15</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L16' href='#L16'><pre>16</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L17' href='#L17'><pre>17</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L18' href='#L18'><pre>18</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L19' href='#L19'><pre>19</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_bytes(&[*self])</span></pre></td></tr><tr><td class='line-number'><a name='L20' href='#L20'><pre>20</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L21' href='#L21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L22' href='#L22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L23' href='#L23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for u16 {</pre></td></tr><tr><td class='line-number'><a name='L24' href='#L24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L25' href='#L25'><pre>25</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L27' href='#L27'><pre>27</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L28' href='#L28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L29' href='#L29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L30' href='#L30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_bytes(&self.to_be_bytes())</span></pre></td></tr><tr><td class='line-number'><a name='L31' href='#L31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L32' href='#L32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L33' href='#L33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L34' href='#L34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for u32 {</pre></td></tr><tr><td class='line-number'><a name='L35' href='#L35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L36' href='#L36'><pre>36</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L37' href='#L37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L38' href='#L38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L39' href='#L39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L40' href='#L40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L41' href='#L41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_bytes(&self.to_be_bytes())</span></pre></td></tr><tr><td class='line-number'><a name='L42' href='#L42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L43' href='#L43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L44' href='#L44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L45' href='#L45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for u64 {</pre></td></tr><tr><td class='line-number'><a name='L46' href='#L46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L47' href='#L47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L48' href='#L48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L49' href='#L49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L50' href='#L50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L51' href='#L51'><pre>51</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L52' href='#L52'><pre>52</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_bytes(&self.to_be_bytes())</span></pre></td></tr><tr><td class='line-number'><a name='L53' href='#L53'><pre>53</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L54' href='#L54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L55' href='#L55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L56' href='#L56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl<const SIZE: usize> WriteBytes for [u8; SIZE] {</pre></td></tr><tr><td class='line-number'><a name='L57' href='#L57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L58' href='#L58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L59' href='#L59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L60' href='#L60'><pre>60</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L61' href='#L61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L62' href='#L62'><pre>62</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L63' href='#L63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_bytes(self)</span></pre></td></tr><tr><td class='line-number'><a name='L64' href='#L64'><pre>64</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L65' href='#L65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L66' href='#L66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L67' href='#L67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for Ipv4Addr {</pre></td></tr><tr><td class='line-number'><a name='L68' href='#L68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L69' href='#L69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L70' href='#L70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L71' href='#L71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L72' href='#L72'><pre>72</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L73' href='#L73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L74' href='#L74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_bytes(&self.octets())</span></pre></td></tr><tr><td class='line-number'><a name='L75' href='#L75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L76' href='#L76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L77' href='#L77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L78' href='#L78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>impl WriteBytes for Ipv6Addr {</pre></td></tr><tr><td class='line-number'><a name='L79' href='#L79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #[inline(always)]</pre></td></tr><tr><td class='line-number'><a name='L80' href='#L80'><pre>80</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>fn write<</span></pre></td></tr><tr><td class='line-number'><a name='L81' href='#L81'><pre>81</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const PTR_STORAGE: usize,</span></pre></td></tr><tr><td class='line-number'><a name='L82' href='#L82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const DNS_SECTION: DnsSection,</span></pre></td></tr><tr><td class='line-number'><a name='L83' href='#L83'><pre>83</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B: Buffer,</span></pre></td></tr><tr><td class='line-number'><a name='L84' href='#L84'><pre>84</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> >(&self, message: &mut DnsMessage<PTR_STORAGE, DNS_SECTION, B>) -> Result<(), DnsMessageError> {</span></pre></td></tr><tr><td class='line-number'><a name='L85' href='#L85'><pre>85</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> message.write_bytes(&self.octets())</span></pre></td></tr><tr><td class='line-number'><a name='L86' href='#L86'><pre>86</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L87' href='#L87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr></table></div></body></html>