cleanups, add semicolon everywhere

This commit is contained in:
Vinzenz Schroeter 2025-06-26 17:29:03 +02:00
parent e8f11c08ea
commit 0968605d0b
19 changed files with 192 additions and 87 deletions

View file

@ -37,14 +37,14 @@ wrap_functions!(associate Bitmap;
/// ```
fn new(width: val usize, height: val usize) -> *mut Bitmap {
heap_move_some(Bitmap::new(width, height))
}
};
/// Creates a new [Bitmap] with a size matching the screen.
///
/// returns: [Bitmap] initialized to all pixels off.
fn new_max_sized() -> NonNull<Bitmap> {
heap_move_nonnull(Bitmap::max_sized())
}
};
/// Loads a [Bitmap] with the specified dimensions from the provided data.
///
@ -61,7 +61,7 @@ wrap_functions!(associate Bitmap;
) -> *mut Bitmap {
let data = unsafe { data.as_slice() };
heap_move_ok(Bitmap::load(width, height, data))
}
};
/// Tries to convert the BitVec to a Bitmap.
///
@ -73,7 +73,7 @@ wrap_functions!(associate Bitmap;
bitvec: move NonNull<DisplayBitVec>,
) -> *mut Bitmap {
heap_move_ok(Bitmap::from_bitvec(width, bitvec))
}
};
);
wrap_methods!(Bitmap;

View file

@ -11,7 +11,6 @@ use std::ptr::NonNull;
wrap_container!(DisplayBitVec);
wrap_functions!(associate DisplayBitVec;
/// Creates a new [DisplayBitVec] instance.
///
/// # Arguments
@ -25,7 +24,7 @@ wrap_functions!(associate DisplayBitVec;
/// - when `size` is not divisible by 8.
fn new(size: val usize) -> NonNull<DisplayBitVec> {
heap_move_nonnull(DisplayBitVec::repeat(false, size))
}
};
/// Interpret the data as a series of bits and load then into a new [DisplayBitVec] instance.
///
@ -33,8 +32,7 @@ wrap_functions!(associate DisplayBitVec;
fn load(data: val ByteSlice) -> NonNull<DisplayBitVec> {
let data = unsafe { data.as_slice() };
heap_move_nonnull(DisplayBitVec::from_slice(data))
}
};
);
wrap_methods!(DisplayBitVec;

View file

@ -32,7 +32,7 @@ wrap_functions!(associate BrightnessGrid;
/// ```
fn new(width: val usize, height: val usize) -> NonNull<BrightnessGrid> {
heap_move_nonnull(BrightnessGrid::new(width, height))
}
};
/// Loads a [BrightnessGrid] with the specified dimensions from the provided data.
///
@ -49,7 +49,7 @@ wrap_functions!(associate BrightnessGrid;
ByteGrid::load(width, height, data)
.map(move |grid| grid.map(Brightness::saturating_from)),
)
}
};
);

View file

@ -10,7 +10,6 @@ wrap_container!(CharGrid);
derive_get_width_height!(CharGrid);
wrap_functions!(associate CharGrid;
/// Creates a new [CharGrid] with the specified dimensions.
///
/// returns: [CharGrid] initialized to 0.
@ -25,7 +24,7 @@ wrap_functions!(associate CharGrid;
/// ```
fn new(width: val usize, height: val usize) -> NonNull<CharGrid> {
heap_move_nonnull(CharGrid::new(width, height))
}
};
/// Loads a [CharGrid] with the specified dimensions from the provided data.
///
@ -33,9 +32,7 @@ wrap_functions!(associate CharGrid;
fn load(width: val usize, height: val usize, data: val ByteSlice) -> *mut CharGrid {
let data = unsafe { data.as_slice() };
heap_move_ok(CharGrid::load_utf8(width, height, data.to_vec()))
}
};
);
wrap_methods!(CharGrid;

View file

@ -16,13 +16,13 @@ wrap_functions!(associate Cp437Grid;
/// returns: [Cp437Grid] initialized to 0.
fn new(width: val usize, height: val usize) -> NonNull<Cp437Grid> {
heap_move_nonnull(Cp437Grid::new(width, height))
}
};
/// Loads a [Cp437Grid] with the specified dimensions from the provided data.
fn load(width: val usize, height: val usize, data: val ByteSlice) -> *mut Cp437Grid {
let data = unsafe { data.as_slice() };
heap_move_some(Cp437Grid::load(width, height, data))
}
};
);
wrap_methods!(Cp437Grid;