rename function to ...try to indicate possible null return

This commit is contained in:
Vinzenz Schroeter 2025-06-22 12:59:13 +02:00
parent b4730ffdf3
commit 7a836783e1
9 changed files with 82 additions and 83 deletions

View file

@ -2,7 +2,6 @@ use crate::{
commands::wrap_command, macros::wrap_functions, mem::heap_move_nonnull,
};
use servicepoint::{ClearCommand, FadeOutCommand, HardResetCommand};
use std::ptr::NonNull;
macro_rules! wrap_cc_only {
($(#[$meta:meta])* $command:ident) => {
@ -13,7 +12,7 @@ macro_rules! wrap_cc_only {
$(#[$meta])*
///
#[doc = " Returns: a new [`" [< $command Command >] "`] instance."]
fn new() -> NonNull<[< $command Command >]> {
fn new() -> ::core::ptr::NonNull<[< $command Command >]> {
heap_move_nonnull([< $command Command >])
}
);

View file

@ -20,9 +20,9 @@ macro_rules! wrap_origin_accessors {
$crate::macros::wrap_functions!(associate $object_type;
#[doc = " Reads the origin field of the [`" $object_type "`]."]
fn get_origin(
command: NonNull<$object_type>,
origin_x: NonNull<usize>,
origin_y: NonNull<usize>,
command: ::core::ptr::NonNull<$object_type>,
origin_x: ::core::ptr::NonNull<usize>,
origin_y: ::core::ptr::NonNull<usize>,
) {
unsafe {
let origin = &command.as_ref().origin;
@ -33,7 +33,7 @@ macro_rules! wrap_origin_accessors {
#[doc = " Overwrites the origin field of the [`" $object_type "`]."]
fn set_origin(
command: NonNull<$object_type>,
command: ::core::ptr::NonNull<$object_type>,
origin_x: usize,
origin_y: usize,
) {
@ -72,7 +72,7 @@ macro_rules! derive_command_into_packet {
///
/// Returns: NULL or a [Packet] containing the command.
fn try_into_packet(
command: NonNull<$command_type>,
command: ::core::ptr::NonNull<$command_type>,
) -> *mut ::servicepoint::Packet {
$crate::mem::heap_move_ok(unsafe { $crate::mem::heap_remove(command) }.try_into())
}