add missing docs
This commit is contained in:
		
							parent
							
								
									947a3fe60e
								
							
						
					
					
						commit
						a4d53d0e56
					
				
					 5 changed files with 31 additions and 3 deletions
				
			
		|  | @ -45,10 +45,23 @@ impl ByteGrid { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /// Iterate over all cells in `ByteGrid`.
 | ||||
|     ///
 | ||||
|     /// Order is equivalent to the following loop:
 | ||||
|     /// ```
 | ||||
|     /// # use servicepoint::{ByteGrid, Grid};
 | ||||
|     /// # let grid = ByteGrid::new(2,2);
 | ||||
|     /// for y in 0..grid.height() {
 | ||||
|     ///     for x in 0..grid.width() {
 | ||||
|     ///         grid.get(x, y)
 | ||||
|     ///     }
 | ||||
|     /// }
 | ||||
|     /// ```
 | ||||
|     pub fn iter(&self) -> Iter<u8> { | ||||
|         self.data.iter() | ||||
|     } | ||||
| 
 | ||||
|     /// Iterate over all rows in `ByteGrid` top to bottom.
 | ||||
|     pub fn iter_rows(&self) -> IterRows { | ||||
|         IterRows { | ||||
|             byte_grid: self, | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| use bitvec::prelude::{BitVec, Msb0}; | ||||
| use bitvec::prelude::BitVec; | ||||
| 
 | ||||
| use crate::command_code::CommandCode; | ||||
| use crate::compression::{into_compressed, into_decompressed}; | ||||
|  | @ -27,7 +27,6 @@ pub type Offset = usize; | |||
| /// Type alias for documenting the meaning of the u16 in enum values
 | ||||
| pub type Brightness = u8; | ||||
| 
 | ||||
| // TODO: check order
 | ||||
| /// A command to send to the display.
 | ||||
| #[derive(Debug, Clone, PartialEq)] | ||||
| pub enum Command { | ||||
|  | @ -369,7 +368,7 @@ impl Command { | |||
|     /// Helper method for Packets into `BitMapLinear*`-Commands
 | ||||
|     fn packet_into_linear_bitmap( | ||||
|         packet: Packet, | ||||
|     ) -> Result<(BitVec<u8, Msb0>, CompressionCode), TryFromPacketError> { | ||||
|     ) -> Result<(SpBitVec, CompressionCode), TryFromPacketError> { | ||||
|         let Packet(Header(_, _, length, sub, reserved), payload) = packet; | ||||
|         if reserved != 0 { | ||||
|             return Err(TryFromPacketError::ExtraneousHeaderValues); | ||||
|  |  | |||
|  | @ -63,10 +63,23 @@ impl PixelGrid { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /// Iterate over all cells in `PixelGrid`.
 | ||||
|     ///
 | ||||
|     /// Order is equivalent to the following loop:
 | ||||
|     /// ```
 | ||||
|     /// # use servicepoint::{PixelGrid, Grid};
 | ||||
|     /// # let grid = PixelGrid::new(8,2);
 | ||||
|     /// for y in 0..grid.height() {
 | ||||
|     ///     for x in 0..grid.width() {
 | ||||
|     ///         grid.get(x, y)
 | ||||
|     ///     }
 | ||||
|     /// }
 | ||||
|     /// ```
 | ||||
|     pub fn iter(&self) -> Iter<'_, u8, Msb0> { | ||||
|         self.bit_vec.iter() | ||||
|     } | ||||
| 
 | ||||
|     /// Iterate over all rows in `PixelGrid` top to bottom.
 | ||||
|     pub fn iter_rows(&self) -> IterRows { | ||||
|         IterRows { | ||||
|             pixel_grid: self, | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ use servicepoint::bitvec::prelude::{BitVec, Msb0}; | |||
| /// cbindgen:no-export
 | ||||
| type SpBitVec = BitVec<u8, Msb0>; | ||||
| 
 | ||||
| /// Opaque struct needed for correct code generation.
 | ||||
| #[derive(Clone)] | ||||
| pub struct CBitVec { | ||||
|     actual: SpBitVec, | ||||
|  |  | |||
|  | @ -1,3 +1,5 @@ | |||
| //! FFI slice helper
 | ||||
| 
 | ||||
| #[repr(C)] | ||||
| /// Represents a span of memory (`&mut [u8]` ) as a struct usable by C code.
 | ||||
| ///
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinzenz Schroeter
						Vinzenz Schroeter