add example for reading packages, fix functions return pointers to copy on stack
This commit is contained in:
		
							parent
							
								
									4ab5305377
								
							
						
					
					
						commit
						0c6efcee56
					
				
					 9 changed files with 86 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -65,7 +65,7 @@ pub unsafe extern "C" fn sp_cmd_bitvec_free(command: NonNull<BitVecCommand>) {
 | 
			
		|||
pub unsafe extern "C" fn sp_cmd_bitvec_get(
 | 
			
		||||
    mut command: NonNull<BitVecCommand>,
 | 
			
		||||
) -> *mut DisplayBitVec {
 | 
			
		||||
    &mut unsafe { command.as_mut() }.bitvec
 | 
			
		||||
    unsafe { &mut command.as_mut().bitvec }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Moves the provided [BitVec] to be contained in the [BitVecCommand].
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ pub unsafe extern "C" fn sp_cmd_brightness_grid_set(
 | 
			
		|||
pub unsafe extern "C" fn sp_cmd_brightness_grid_get(
 | 
			
		||||
    mut command: NonNull<BrightnessGridCommand>,
 | 
			
		||||
) -> *mut BrightnessGrid {
 | 
			
		||||
    &mut unsafe { command.as_mut() }.grid
 | 
			
		||||
    unsafe { &mut command.as_mut().grid }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Overwrites the origin field of the [BrightnessGridCommand].
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ pub unsafe extern "C" fn sp_cmd_char_grid_set(
 | 
			
		|||
pub unsafe extern "C" fn sp_cmd_char_grid_get(
 | 
			
		||||
    mut command: NonNull<CharGridCommand>,
 | 
			
		||||
) -> *mut CharGrid {
 | 
			
		||||
    &mut unsafe { command.as_mut() }.grid
 | 
			
		||||
    unsafe { &mut command.as_mut().grid }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Reads the origin field of the [CharGridCommand].
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -83,7 +83,7 @@ pub unsafe extern "C" fn sp_cmd_cp437_grid_set(
 | 
			
		|||
pub unsafe extern "C" fn sp_cmd_cp437_grid_get(
 | 
			
		||||
    mut command: NonNull<Cp437GridCommand>,
 | 
			
		||||
) -> *mut Cp437Grid {
 | 
			
		||||
    &mut unsafe { command.as_mut() }.grid
 | 
			
		||||
    unsafe { &mut command.as_mut().grid }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Gets the origin field of the [Cp437GridCommand].
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,5 +53,5 @@ pub unsafe extern "C" fn sp_cmd_brightness_global_set(
 | 
			
		|||
pub unsafe extern "C" fn sp_cmd_brightness_global_get(
 | 
			
		||||
    mut command: NonNull<GlobalBrightnessCommand>,
 | 
			
		||||
) -> *mut Brightness {
 | 
			
		||||
    &mut unsafe { command.as_mut() }.brightness
 | 
			
		||||
    unsafe { &mut command.as_mut().brightness }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue