Seek to the specified position.
(&mut self, pos: SeekFrom)
| 81 | impl Seek for BinaryWriter { |
| 82 | /// Seek to the specified position. |
| 83 | fn seek(&mut self, pos: SeekFrom) -> std::io::Result<u64> { |
| 84 | match pos { |
| 85 | SeekFrom::Current(offset) => self.seek_to_relative_offset(offset), |
| 86 | SeekFrom::Start(offset) => self.seek_to_offset(offset), |
| 87 | SeekFrom::End(end_offset) => { |
| 88 | let view_end = self.view.original_image_base() + self.view.len(); |
| 89 | let offset = view_end |
| 90 | .checked_add_signed(end_offset) |
| 91 | .ok_or(std::io::Error::new( |
| 92 | ErrorKind::Other, |
| 93 | "Seeking from end overflowed", |
| 94 | ))?; |
| 95 | self.seek_to_offset(offset); |
| 96 | } |
| 97 | }; |
| 98 | |
| 99 | Ok(self.offset()) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | impl Write for BinaryWriter { |
nothing calls this directly
no test coverage detected