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

@ -636,6 +636,8 @@ extern "C" {
#endif // __cplusplus
/**
* Calls method [`servicepoint::Bitmap::clone`].
*
*Clones a [`Bitmap`] instance.
*
* This function is part of the `bitmap` module.
@ -667,6 +669,8 @@ struct ByteSlice sp_bitmap_data_ref_mut(struct Bitmap */*notnull*/ instance);
void sp_bitmap_fill(struct Bitmap */*notnull*/ instance, bool value);
/**
* Calls method [`servicepoint::Bitmap::free`].
*
*Deallocates a [`Bitmap`] instance.
*
* This function is part of the `bitmap` module.
@ -821,6 +825,8 @@ struct Packet *sp_bitmap_try_into_packet(struct Bitmap */*notnull*/ bitmap,
size_t sp_bitmap_width(struct Bitmap */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitmapCommand::clone`].
*
*Clones a [`BitmapCommand`] instance.
*
* This function is part of the `bitmapcommand` module.
@ -828,6 +834,8 @@ size_t sp_bitmap_width(struct Bitmap */*notnull*/ instance);
struct BitmapCommand */*notnull*/ sp_bitmapcommand_clone(struct BitmapCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitmapCommand::free`].
*
*Deallocates a [`BitmapCommand`] instance.
*
* This function is part of the `bitmapcommand` module.
@ -845,6 +853,8 @@ void sp_bitmapcommand_free(struct BitmapCommand */*notnull*/ instance);
struct BitmapCommand */*notnull*/ sp_bitmapcommand_from_bitmap(struct Bitmap */*notnull*/ bitmap);
/**
* Calls method [`servicepoint::BitmapCommand::get_bitmap_mut`].
*
* Gets a reference to the field `bitmap` of the [`servicepoint::BitmapCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
@ -855,6 +865,8 @@ struct BitmapCommand */*notnull*/ sp_bitmapcommand_from_bitmap(struct Bitmap */*
struct Bitmap */*notnull*/ sp_bitmapcommand_get_bitmap_mut(struct BitmapCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitmapCommand::get_compression`].
*
* Gets the value of field `compression` of the [`servicepoint::BitmapCommand`].
*
* This function is part of the `bitmapcommand` module.
@ -862,6 +874,8 @@ struct Bitmap */*notnull*/ sp_bitmapcommand_get_bitmap_mut(struct BitmapCommand
CompressionCode sp_bitmapcommand_get_compression(struct BitmapCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitmapCommand::get_origin`].
*
* Reads the origin field of the [`BitmapCommand`].
*
* This function is part of the `bitmapcommand` module.
@ -885,6 +899,8 @@ struct BitmapCommand */*notnull*/ sp_bitmapcommand_new(struct Bitmap */*notnull*
CompressionCode compression);
/**
* Calls method [`servicepoint::BitmapCommand::set_bitmap`].
*
* Sets the value of field `bitmap` of the [`servicepoint::BitmapCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
@ -894,6 +910,8 @@ void sp_bitmapcommand_set_bitmap(struct BitmapCommand */*notnull*/ instance,
struct Bitmap */*notnull*/ value);
/**
* Calls method [`servicepoint::BitmapCommand::set_compression`].
*
* Sets the value of field `compression` of the [`servicepoint::BitmapCommand`].
*
* This function is part of the `bitmapcommand` module.
@ -902,6 +920,8 @@ void sp_bitmapcommand_set_compression(struct BitmapCommand */*notnull*/ instance
CompressionCode value);
/**
* Calls method [`servicepoint::BitmapCommand::set_origin`].
*
* Overwrites the origin field of the [`BitmapCommand`].
*
* This function is part of the `bitmapcommand` module.
@ -922,6 +942,8 @@ void sp_bitmapcommand_set_origin(struct BitmapCommand */*notnull*/ command,
struct Packet *sp_bitmapcommand_try_into_packet(struct BitmapCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitVecCommand::clone`].
*
*Clones a [`BitVecCommand`] instance.
*
* This function is part of the `bitveccommand` module.
@ -929,6 +951,8 @@ struct Packet *sp_bitmapcommand_try_into_packet(struct BitmapCommand */*notnull*
struct BitVecCommand */*notnull*/ sp_bitveccommand_clone(struct BitVecCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitVecCommand::free`].
*
*Deallocates a [`BitVecCommand`] instance.
*
* This function is part of the `bitveccommand` module.
@ -936,6 +960,8 @@ struct BitVecCommand */*notnull*/ sp_bitveccommand_clone(struct BitVecCommand */
void sp_bitveccommand_free(struct BitVecCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitVecCommand::get_bitvec_mut`].
*
* Gets a reference to the field `bitvec` of the [`servicepoint::BitVecCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
@ -946,6 +972,8 @@ void sp_bitveccommand_free(struct BitVecCommand */*notnull*/ instance);
DisplayBitVec */*notnull*/ sp_bitveccommand_get_bitvec_mut(struct BitVecCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitVecCommand::get_compression`].
*
* Gets the value of field `compression` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
@ -953,6 +981,8 @@ DisplayBitVec */*notnull*/ sp_bitveccommand_get_bitvec_mut(struct BitVecCommand
CompressionCode sp_bitveccommand_get_compression(struct BitVecCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitVecCommand::get_offset`].
*
* Gets the value of field `offset` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
@ -960,6 +990,8 @@ CompressionCode sp_bitveccommand_get_compression(struct BitVecCommand */*notnull
Offset sp_bitveccommand_get_offset(struct BitVecCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitVecCommand::get_operation`].
*
* Gets the value of field `operation` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
@ -988,6 +1020,8 @@ struct BitVecCommand */*notnull*/ sp_bitveccommand_new(DisplayBitVec */*notnull*
CompressionCode compression);
/**
* Calls method [`servicepoint::BitVecCommand::set_bitvec`].
*
* Sets the value of field `bitvec` of the [`servicepoint::BitVecCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
@ -997,6 +1031,8 @@ void sp_bitveccommand_set_bitvec(struct BitVecCommand */*notnull*/ instance,
DisplayBitVec */*notnull*/ value);
/**
* Calls method [`servicepoint::BitVecCommand::set_compression`].
*
* Sets the value of field `compression` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
@ -1005,6 +1041,8 @@ void sp_bitveccommand_set_compression(struct BitVecCommand */*notnull*/ instance
CompressionCode value);
/**
* Calls method [`servicepoint::BitVecCommand::set_offset`].
*
* Sets the value of field `offset` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
@ -1013,6 +1051,8 @@ void sp_bitveccommand_set_offset(struct BitVecCommand */*notnull*/ instance,
Offset value);
/**
* Calls method [`servicepoint::BitVecCommand::set_operation`].
*
* Sets the value of field `operation` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
@ -1032,6 +1072,8 @@ void sp_bitveccommand_set_operation(struct BitVecCommand */*notnull*/ instance,
struct Packet *sp_bitveccommand_try_into_packet(struct BitVecCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BrightnessGrid::clone`].
*
*Clones a [`BrightnessGrid`] instance.
*
* This function is part of the `brightnessgrid` module.
@ -1064,6 +1106,8 @@ void sp_brightnessgrid_fill(BrightnessGrid */*notnull*/ instance,
Brightness value);
/**
* Calls method [`servicepoint::BrightnessGrid::free`].
*
*Deallocates a [`BrightnessGrid`] instance.
*
* This function is part of the `brightnessgrid` module.
@ -1180,6 +1224,8 @@ struct Packet *sp_brightnessgrid_try_into_packet(BrightnessGrid */*notnull*/ gri
size_t sp_brightnessgrid_width(BrightnessGrid */*notnull*/ instance);
/**
* Calls method [`servicepoint::BrightnessGridCommand::clone`].
*
*Clones a [`BrightnessGridCommand`] instance.
*
* This function is part of the `brightnessgridcommand` module.
@ -1187,6 +1233,8 @@ size_t sp_brightnessgrid_width(BrightnessGrid */*notnull*/ instance);
struct BrightnessGridCommand */*notnull*/ sp_brightnessgridcommand_clone(struct BrightnessGridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BrightnessGridCommand::free`].
*
*Deallocates a [`BrightnessGridCommand`] instance.
*
* This function is part of the `brightnessgridcommand` module.
@ -1202,6 +1250,8 @@ void sp_brightnessgridcommand_free(struct BrightnessGridCommand */*notnull*/ ins
struct BrightnessGridCommand */*notnull*/ sp_brightnessgridcommand_from_grid(BrightnessGrid */*notnull*/ grid);
/**
* Calls method [`servicepoint::BrightnessGridCommand::get_grid_mut`].
*
* Gets a reference to the field `grid` of the [`servicepoint::BrightnessGridCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
@ -1212,6 +1262,8 @@ struct BrightnessGridCommand */*notnull*/ sp_brightnessgridcommand_from_grid(Bri
BrightnessGrid */*notnull*/ sp_brightnessgridcommand_get_grid_mut(struct BrightnessGridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BrightnessGridCommand::get_origin`].
*
* Reads the origin field of the [`BrightnessGridCommand`].
*
* This function is part of the `brightnessgridcommand` module.
@ -1234,6 +1286,8 @@ struct BrightnessGridCommand */*notnull*/ sp_brightnessgridcommand_new(Brightnes
size_t origin_y);
/**
* Calls method [`servicepoint::BrightnessGridCommand::set_grid`].
*
* Sets the value of field `grid` of the [`servicepoint::BrightnessGridCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
@ -1243,6 +1297,8 @@ void sp_brightnessgridcommand_set_grid(struct BrightnessGridCommand */*notnull*/
BrightnessGrid */*notnull*/ value);
/**
* Calls method [`servicepoint::BrightnessGridCommand::set_origin`].
*
* Overwrites the origin field of the [`BrightnessGridCommand`].
*
* This function is part of the `brightnessgridcommand` module.
@ -1263,6 +1319,8 @@ void sp_brightnessgridcommand_set_origin(struct BrightnessGridCommand */*notnull
struct Packet *sp_brightnessgridcommand_try_into_packet(struct BrightnessGridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::CharGrid::clone`].
*
*Clones a [`CharGrid`] instance.
*
* This function is part of the `chargrid` module.
@ -1284,6 +1342,8 @@ CharGrid */*notnull*/ sp_chargrid_clone(CharGrid */*notnull*/ instance);
void sp_chargrid_fill(CharGrid */*notnull*/ instance, uint32_t value);
/**
* Calls method [`servicepoint::CharGrid::free`].
*
*Deallocates a [`CharGrid`] instance.
*
* This function is part of the `chargrid` module.
@ -1392,6 +1452,8 @@ struct Packet *sp_chargrid_try_into_packet(CharGrid */*notnull*/ grid,
size_t sp_chargrid_width(CharGrid */*notnull*/ instance);
/**
* Calls method [`servicepoint::CharGridCommand::clone`].
*
*Clones a [`CharGridCommand`] instance.
*
* This function is part of the `chargridcommand` module.
@ -1399,6 +1461,8 @@ size_t sp_chargrid_width(CharGrid */*notnull*/ instance);
struct CharGridCommand */*notnull*/ sp_chargridcommand_clone(struct CharGridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::CharGridCommand::free`].
*
*Deallocates a [`CharGridCommand`] instance.
*
* This function is part of the `chargridcommand` module.
@ -1414,6 +1478,8 @@ void sp_chargridcommand_free(struct CharGridCommand */*notnull*/ instance);
struct CharGridCommand */*notnull*/ sp_chargridcommand_from_grid(CharGrid */*notnull*/ grid);
/**
* Calls method [`servicepoint::CharGridCommand::get_grid_mut`].
*
* Gets a reference to the field `grid` of the [`servicepoint::CharGridCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
@ -1424,6 +1490,8 @@ struct CharGridCommand */*notnull*/ sp_chargridcommand_from_grid(CharGrid */*not
CharGrid */*notnull*/ sp_chargridcommand_get_grid_mut(struct CharGridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::CharGridCommand::get_origin`].
*
* Reads the origin field of the [`CharGridCommand`].
*
* This function is part of the `chargridcommand` module.
@ -1446,6 +1514,8 @@ struct CharGridCommand */*notnull*/ sp_chargridcommand_new(CharGrid */*notnull*/
size_t origin_y);
/**
* Calls method [`servicepoint::CharGridCommand::set_grid`].
*
* Sets the value of field `grid` of the [`servicepoint::CharGridCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
@ -1455,6 +1525,8 @@ void sp_chargridcommand_set_grid(struct CharGridCommand */*notnull*/ instance,
CharGrid */*notnull*/ value);
/**
* Calls method [`servicepoint::CharGridCommand::set_origin`].
*
* Overwrites the origin field of the [`CharGridCommand`].
*
* This function is part of the `chargridcommand` module.
@ -1475,6 +1547,8 @@ void sp_chargridcommand_set_origin(struct CharGridCommand */*notnull*/ command,
struct Packet *sp_chargridcommand_try_into_packet(struct CharGridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::ClearCommand::clone`].
*
*Clones a [`ClearCommand`] instance.
*
* This function is part of the `clearcommand` module.
@ -1482,6 +1556,8 @@ struct Packet *sp_chargridcommand_try_into_packet(struct CharGridCommand */*notn
struct ClearCommand */*notnull*/ sp_clearcommand_clone(struct ClearCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::ClearCommand::free`].
*
*Deallocates a [`ClearCommand`] instance.
*
* This function is part of the `clearcommand` module.
@ -1511,6 +1587,8 @@ struct ClearCommand */*notnull*/ sp_clearcommand_new(void);
struct Packet *sp_clearcommand_try_into_packet(struct ClearCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437Grid::clone`].
*
*Clones a [`Cp437Grid`] instance.
*
* This function is part of the `cp437grid` module.
@ -1542,6 +1620,8 @@ struct ByteSlice sp_cp437grid_data_ref_mut(Cp437Grid */*notnull*/ instance);
void sp_cp437grid_fill(Cp437Grid */*notnull*/ instance, uint8_t value);
/**
* Calls method [`servicepoint::Cp437Grid::free`].
*
*Deallocates a [`Cp437Grid`] instance.
*
* This function is part of the `cp437grid` module.
@ -1638,6 +1718,8 @@ struct Packet *sp_cp437grid_try_into_packet(Cp437Grid */*notnull*/ grid,
size_t sp_cp437grid_width(Cp437Grid */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437GridCommand::clone`].
*
*Clones a [`Cp437GridCommand`] instance.
*
* This function is part of the `cp437gridcommand` module.
@ -1645,6 +1727,8 @@ size_t sp_cp437grid_width(Cp437Grid */*notnull*/ instance);
struct Cp437GridCommand */*notnull*/ sp_cp437gridcommand_clone(struct Cp437GridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437GridCommand::free`].
*
*Deallocates a [`Cp437GridCommand`] instance.
*
* This function is part of the `cp437gridcommand` module.
@ -1660,6 +1744,8 @@ void sp_cp437gridcommand_free(struct Cp437GridCommand */*notnull*/ instance);
struct Cp437GridCommand */*notnull*/ sp_cp437gridcommand_from_grid(Cp437Grid */*notnull*/ grid);
/**
* Calls method [`servicepoint::Cp437GridCommand::get_grid_mut`].
*
* Gets a reference to the field `grid` of the [`servicepoint::Cp437GridCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
@ -1670,6 +1756,8 @@ struct Cp437GridCommand */*notnull*/ sp_cp437gridcommand_from_grid(Cp437Grid */*
Cp437Grid */*notnull*/ sp_cp437gridcommand_get_grid_mut(struct Cp437GridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437GridCommand::get_origin`].
*
* Reads the origin field of the [`Cp437GridCommand`].
*
* This function is part of the `cp437gridcommand` module.
@ -1692,6 +1780,8 @@ struct Cp437GridCommand */*notnull*/ sp_cp437gridcommand_new(Cp437Grid */*notnul
size_t origin_y);
/**
* Calls method [`servicepoint::Cp437GridCommand::set_grid`].
*
* Sets the value of field `grid` of the [`servicepoint::Cp437GridCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
@ -1701,6 +1791,8 @@ void sp_cp437gridcommand_set_grid(struct Cp437GridCommand */*notnull*/ instance,
Cp437Grid */*notnull*/ value);
/**
* Calls method [`servicepoint::Cp437GridCommand::set_origin`].
*
* Overwrites the origin field of the [`Cp437GridCommand`].
*
* This function is part of the `cp437gridcommand` module.
@ -1732,6 +1824,8 @@ struct Packet *sp_cp437gridcommand_try_into_packet(struct Cp437GridCommand */*no
struct ByteSlice sp_displaybitvec_as_raw_mut_slice(DisplayBitVec */*notnull*/ instance);
/**
* Calls method [`servicepoint::DisplayBitVec::clone`].
*
*Clones a [`DisplayBitVec`] instance.
*
* This function is part of the `displaybitvec` module.
@ -1752,6 +1846,8 @@ DisplayBitVec */*notnull*/ sp_displaybitvec_clone(DisplayBitVec */*notnull*/ ins
void sp_displaybitvec_fill(DisplayBitVec */*notnull*/ instance, bool value);
/**
* Calls method [`servicepoint::DisplayBitVec::free`].
*
*Deallocates a [`DisplayBitVec`] instance.
*
* This function is part of the `displaybitvec` module.
@ -1867,6 +1963,8 @@ struct Packet *sp_displaybitvec_try_into_packet(DisplayBitVec */*notnull*/ bitve
void sp_envlogger_init(void);
/**
* Calls method [`servicepoint::FadeOutCommand::clone`].
*
*Clones a [`FadeOutCommand`] instance.
*
* This function is part of the `fadeoutcommand` module.
@ -1874,6 +1972,8 @@ void sp_envlogger_init(void);
struct FadeOutCommand */*notnull*/ sp_fadeoutcommand_clone(struct FadeOutCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::FadeOutCommand::free`].
*
*Deallocates a [`FadeOutCommand`] instance.
*
* This function is part of the `fadeoutcommand` module.
@ -1901,6 +2001,8 @@ struct FadeOutCommand */*notnull*/ sp_fadeoutcommand_new(void);
struct Packet *sp_fadeoutcommand_try_into_packet(struct FadeOutCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::GenericCommand::clone`].
*
*Clones a [`GenericCommand`] instance.
*
* This function is part of the `genericcommand` module.
@ -1908,6 +2010,8 @@ struct Packet *sp_fadeoutcommand_try_into_packet(struct FadeOutCommand */*notnul
struct GenericCommand */*notnull*/ sp_genericcommand_clone(struct GenericCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::GenericCommand::free`].
*
*Deallocates a [`GenericCommand`] instance.
*
* This function is part of the `genericcommand` module.
@ -1938,6 +2042,8 @@ struct GenericCommand */*notnull*/ sp_genericcommand_try_from_packet(struct Pack
struct Packet *sp_genericcommand_try_into_packet(struct GenericCommand */*notnull*/ command);
/**
* Calls method [`servicepoint::GlobalBrightnessCommand::clone`].
*
*Clones a [`GlobalBrightnessCommand`] instance.
*
* This function is part of the `globalbrightnesscommand` module.
@ -1945,6 +2051,8 @@ struct Packet *sp_genericcommand_try_into_packet(struct GenericCommand */*notnul
struct GlobalBrightnessCommand */*notnull*/ sp_globalbrightnesscommand_clone(struct GlobalBrightnessCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::GlobalBrightnessCommand::free`].
*
*Deallocates a [`GlobalBrightnessCommand`] instance.
*
* This function is part of the `globalbrightnesscommand` module.
@ -1952,6 +2060,8 @@ struct GlobalBrightnessCommand */*notnull*/ sp_globalbrightnesscommand_clone(str
void sp_globalbrightnesscommand_free(struct GlobalBrightnessCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::GlobalBrightnessCommand::get_brightness`].
*
* Gets the value of field `brightness` of the [`servicepoint::GlobalBrightnessCommand`].
*
* This function is part of the `globalbrightnesscommand` module.
@ -1968,6 +2078,8 @@ Brightness sp_globalbrightnesscommand_get_brightness(struct GlobalBrightnessComm
struct GlobalBrightnessCommand */*notnull*/ sp_globalbrightnesscommand_new(Brightness brightness);
/**
* Calls method [`servicepoint::GlobalBrightnessCommand::set_brightness`].
*
* Sets the value of field `brightness` of the [`servicepoint::GlobalBrightnessCommand`].
*
* This function is part of the `globalbrightnesscommand` module.
@ -1987,6 +2099,8 @@ void sp_globalbrightnesscommand_set_brightness(struct GlobalBrightnessCommand */
struct Packet *sp_globalbrightnesscommand_try_into_packet(struct GlobalBrightnessCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::HardResetCommand::clone`].
*
*Clones a [`HardResetCommand`] instance.
*
* This function is part of the `hardresetcommand` module.
@ -1994,6 +2108,8 @@ struct Packet *sp_globalbrightnesscommand_try_into_packet(struct GlobalBrightnes
struct HardResetCommand */*notnull*/ sp_hardresetcommand_clone(struct HardResetCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::HardResetCommand::free`].
*
*Deallocates a [`HardResetCommand`] instance.
*
* This function is part of the `hardresetcommand` module.
@ -2023,6 +2139,8 @@ struct HardResetCommand */*notnull*/ sp_hardresetcommand_new(void);
struct Packet *sp_hardresetcommand_try_into_packet(struct HardResetCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::Packet::clone`].
*
*Clones a [`Packet`] instance.
*
* This function is part of the `packet` module.
@ -2030,6 +2148,8 @@ struct Packet *sp_hardresetcommand_try_into_packet(struct HardResetCommand */*no
struct Packet */*notnull*/ sp_packet_clone(struct Packet */*notnull*/ instance);
/**
* Calls method [`servicepoint::Packet::free`].
*
*Deallocates a [`Packet`] instance.
*
* This function is part of the `packet` module.
@ -2047,6 +2167,8 @@ struct Packet */*notnull*/ sp_packet_from_parts(struct Header header,
struct ByteSlice payload);
/**
* Calls method [`servicepoint::Packet::get_header`].
*
* Gets the value of field `header` of the [`servicepoint::Packet`].
*
* This function is part of the `packet` module.
@ -2054,6 +2176,8 @@ struct Packet */*notnull*/ sp_packet_from_parts(struct Header header,
struct Header sp_packet_get_header(struct Packet */*notnull*/ instance);
/**
* Calls method [`servicepoint::Packet::get_header_mut`].
*
* Gets a reference to the field `header` of the [`servicepoint::Packet`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
@ -2064,6 +2188,8 @@ struct Header sp_packet_get_header(struct Packet */*notnull*/ instance);
struct Header */*notnull*/ sp_packet_get_header_mut(struct Packet */*notnull*/ instance);
/**
* Calls method [`servicepoint::Packet::get_payload`].
*
* Returns a pointer to the current payload of the provided packet.
*
* Returns an [ByteSlice::INVALID] instance in case the packet does not have any payload.
@ -2075,6 +2201,8 @@ struct Header */*notnull*/ sp_packet_get_header_mut(struct Packet */*notnull*/ i
struct ByteSlice sp_packet_get_payload(struct Packet */*notnull*/ packet);
/**
* Calls method [`servicepoint::Packet::serialize_to`].
*
* Serialize the packet into the provided buffer.
*
* # Panics
@ -2087,6 +2215,8 @@ size_t sp_packet_serialize_to(struct Packet */*notnull*/ packet,
struct ByteSlice buffer);
/**
* Calls method [`servicepoint::Packet::set_header`].
*
* Sets the value of field `header` of the [`servicepoint::Packet`].
*
* This function is part of the `packet` module.
@ -2095,6 +2225,8 @@ void sp_packet_set_header(struct Packet */*notnull*/ instance,
struct Header value);
/**
* Calls method [`servicepoint::Packet::set_payload`].
*
* Sets the payload of the provided packet to the provided data.
*
* This makes previous payload pointers invalid.
@ -2121,9 +2253,11 @@ struct Packet *sp_packet_try_load(struct ByteSlice data);
* This function is part of the `sp` module.
*/
bool sp_sp_u16_to_command_code(uint16_t code,
CommandCode *result);
CommandCode */*notnull*/ result);
/**
* Calls method [`servicepoint::UdpSocket::free`].
*
*Deallocates a [`UdpSocket`] instance.
*
* This function is part of the `udpsocket` module.

View file

@ -32,7 +32,7 @@ wrap_functions!(associate BitmapCommand;
origin: Origin::new(origin_x, origin_y),
compression,
})
}
};
/// Move the provided [Bitmap] into a new [BitmapCommand],
/// leaving other fields as their default values.
@ -40,5 +40,5 @@ wrap_functions!(associate BitmapCommand;
/// Rust equivalent: `BitmapCommand::from(bitmap)`
fn from_bitmap(bitmap: move NonNull<Bitmap>) -> NonNull<BitmapCommand> {
heap_move_nonnull(bitmap.into())
}
};
);

View file

@ -18,7 +18,6 @@ wrap_fields!(BitVecCommand;
);
wrap_functions!(associate BitVecCommand;
/// Set pixel data starting at the pixel offset on screen.
///
/// The screen will continuously overwrite more pixel data without regarding the offset, meaning
@ -43,6 +42,5 @@ wrap_functions!(associate BitVecCommand;
operation,
compression,
})
}
};
);

View file

@ -15,7 +15,6 @@ wrap_fields!(BrightnessGridCommand;
wrap_origin_accessors!(BrightnessGridCommand);
wrap_functions!(associate BrightnessGridCommand;
/// Set the brightness of individual tiles in a rectangular area of the display.
///
/// The passed [BrightnessGrid] gets consumed.
@ -30,12 +29,11 @@ wrap_functions!(associate BrightnessGridCommand;
grid,
origin: Origin::new(origin_x, origin_y),
})
}
};
/// Moves the provided [BrightnessGrid] into a new [BrightnessGridCommand],
/// leaving other fields as their default values.
fn from_grid(grid: move NonNull<BrightnessGrid>) -> NonNull<BrightnessGridCommand> {
heap_move_nonnull(grid.into())
}
};
);

View file

@ -14,7 +14,7 @@ macro_rules! wrap_cc_only {
#[doc = " Returns: a new [`" [< $command Command >] "`] instance."]
fn new() -> ::core::ptr::NonNull<[< $command Command >]> {
heap_move_nonnull([< $command Command >])
}
};
);
}
};

View file

@ -15,7 +15,6 @@ wrap_fields!(CharGridCommand;
wrap_origin_accessors!(CharGridCommand);
wrap_functions!(associate CharGridCommand;
/// Show UTF-8 encoded text on the screen.
///
/// The passed [CharGrid] gets consumed.
@ -30,12 +29,11 @@ wrap_functions!(associate CharGridCommand;
grid,
origin: Origin::new(origin_x, origin_y),
})
}
};
/// Moves the provided [CharGrid] into a new [CharGridCommand],
/// leaving other fields as their default values.
fn from_grid(grid: move NonNull<CharGrid>) -> NonNull<CharGridCommand> {
heap_move_nonnull(grid.into())
}
};
);

View file

@ -15,7 +15,6 @@ wrap_fields!(Cp437GridCommand;
wrap_origin_accessors!(Cp437GridCommand);
wrap_functions!(associate Cp437GridCommand;
/// Show text on the screen.
///
/// The text is sent in the form of a 2D grid of [CP-437] encoded characters.
@ -30,12 +29,11 @@ wrap_functions!(associate Cp437GridCommand;
grid,
origin: Origin::new(origin_x, origin_y),
})
}
};
/// Moves the provided [Cp437Grid] into a new [Cp437GridCommand],
/// leaving other fields as their default values.
fn from_grid(grid: move NonNull<Cp437Grid>) -> NonNull<Cp437GridCommand> {
heap_move_nonnull(grid.into())
}
};
);

View file

@ -248,7 +248,7 @@ wrap_functions!(associate GenericCommand;
data: CommandUnion { null: null_mut() },
});
heap_move_nonnull(result)
}
};
);
wrap_methods! { GenericCommand;

View file

@ -7,14 +7,12 @@ use servicepoint::{Brightness, GlobalBrightnessCommand};
use std::ptr::NonNull;
wrap_functions!(associate GlobalBrightnessCommand;
/// Set the brightness of all tiles to the same value.
///
/// Returns: a new [GlobalBrightnessCommand] instance.
fn new(brightness: val Brightness) -> NonNull<GlobalBrightnessCommand> {
heap_move_nonnull(GlobalBrightnessCommand::from(brightness))
}
};
);
wrap_command!(GlobalBrightness);

View file

@ -64,7 +64,7 @@ macro_rules! derive_command_into_packet {
/// Returns: NULL or a [Packet] containing the command.
fn try_into_packet(move instance) -> *mut ::servicepoint::Packet {
$crate::mem::heap_move_ok(instance.try_into())
}
};
);
}
}

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;

View file

@ -48,6 +48,6 @@ mod feature_env_logger {
/// `RUST_LOG` environment variable. See [env_logger](https://docs.rs/env_logger/latest/env_logger/).
fn init() {
env_logger::init();
}
};
);
}

View file

@ -1,48 +1,36 @@
macro_rules! derive_free {
($typ:ident) => {
::paste::paste! {
$crate::macros::wrap_functions!([< $typ:lower >];
$crate::macros::wrap_method!($typ;
#[doc = "Deallocates a [`" $typ "`] instance."]
#[allow(dropping_copy_types)]
fn free(instance: move ::core::ptr::NonNull<$typ>) {
fn free(move instance) {
::std::mem::drop(instance)
}
};
);
}
};
}
macro_rules! derive_clone {
($typ:ident) => {
($object_type:ident) => {
::paste::paste! {
$crate::macros::wrap_functions!([< $typ:lower >];
#[doc = "Clones a [`" $typ "`] instance."]
fn clone(instance: ref ::core::ptr::NonNull<$typ>) -> ::core::ptr::NonNull<$typ> {
$crate::macros::wrap_method!($object_type;
#[doc = "Clones a [`" $object_type "`] instance."]
fn clone(ref instance) -> ::core::ptr::NonNull<$object_type> {
$crate::mem::heap_move_nonnull(instance.clone())
}
};
);
}
};
}
macro_rules! nonnull_as_ref {
($ident:ident) => {
$ident.as_ref()
};
}
macro_rules! nonnull_as_mut {
($ident:ident) => {
(&mut *$ident.as_ptr())
};
}
macro_rules! wrap_method {
(
$object_type:ident;
$(#[$meta:meta])+
fn $function:ident($ref_or_mut:ident $instance:ident $(, $($param_name:ident: $param_modifier:ident $param_type:ty),*)?)
$(-> $return_type:ty)?
$(-> $return_type:ty)?;
) => {
::paste::paste!{
$crate::macros::wrap_method!(
@ -51,7 +39,7 @@ macro_rules! wrap_method {
fn $function($ref_or_mut $instance $(, $($param_name: $param_modifier $param_type),*)?)
$(-> $return_type)? {
$instance.$function($($($param_name),*)?)
}
};
);
}
};
@ -59,7 +47,7 @@ macro_rules! wrap_method {
$(#[$meta:meta])+
fn $function:ident($ref_or_mut:ident $instance:ident $(, $($param_name:ident: $param_modifier:ident $param_type:ty),*)?)
$(-> $return_type:ty)?
$impl:block
$impl:block;
) => {
paste::paste! {
$crate::macros::wrap_functions!([< $object_type:lower >];
@ -70,7 +58,7 @@ macro_rules! wrap_method {
$instance: $ref_or_mut ::core::ptr::NonNull<$object_type>
$(,$($param_name: $param_modifier $param_type),*)?
) $(-> $return_type)?
$impl
$impl;
);
}
};
@ -92,7 +80,7 @@ macro_rules! wrap_methods {
$(#[$meta])*
fn $function($ref_or_mut $instance $(, $($param_name: $param_modifier $param_type),*)?)
$(-> $return_type)?
$($impl)?
$($impl)?;
);
)+
}
@ -107,7 +95,7 @@ macro_rules! wrap_fields_accessor {
"` of the [`servicepoint::" $object_type "`]."]
fn [<get _ $prop_name>](ref instance) -> $prop_type {
return instance.$prop_name;
}
};
}
}
};
@ -121,7 +109,7 @@ macro_rules! wrap_fields_accessor {
/// - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
fn [<get _ $prop_name _mut>](mut instance) -> ::core::ptr::NonNull<$prop_type> {
return ::core::ptr::NonNull::from(&mut instance.$prop_name);
}
};
}
}
};
@ -132,7 +120,7 @@ macro_rules! wrap_fields_accessor {
"` of the [`servicepoint::" $object_type "`]."]
fn [<set _ $prop_name>](mut instance, value: val $prop_type) {
instance.$prop_name = value;
}
};
}
}
};
@ -144,7 +132,7 @@ macro_rules! wrap_fields_accessor {
/// The provided value is moved into the instance, potentially invalidating previously taken references.
fn [<set _ $prop_name>](mut instance, value: move ::core::ptr::NonNull<$prop_type>) {
instance.$prop_name = value;
}
};
}
}
};
@ -176,10 +164,10 @@ macro_rules! apply_param_modifier {
$param_name
};
(mut, $param_name:ident) => {
unsafe { $crate::macros::nonnull_as_mut!($param_name) }
unsafe { (&mut *$param_name.as_ptr()) }
};
(ref, $param_name:ident) => {
unsafe { $crate::macros::nonnull_as_ref!($param_name) }
unsafe { $param_name.as_ref() }
};
}
@ -189,7 +177,7 @@ macro_rules! wrap_function {
$(#[$meta:meta])+
fn $function:ident($($param_name:ident: $param_modifier:ident $param_type:ty),*$(,)?)
$(-> $return_type:ty)?
$block:block
$block:block;
) => {
::paste::paste! {
$(#[$meta])*
@ -216,7 +204,7 @@ macro_rules! wrap_functions {
$(#[$meta:meta])+
fn $function:ident($($param_name:ident: $param_modifier:ident $param_type:ty),*$(,)?)
$(-> $return_type:ty)?
$block:block
$block:block;
)+
) => {
::paste::paste! {
@ -224,7 +212,7 @@ macro_rules! wrap_functions {
$crate::macros::wrap_function!($module;
$(#[$meta])+
fn $function($($param_name: $param_modifier $param_type),*) $(-> $return_type)?
$block
$block;
);
)+
}
@ -235,7 +223,7 @@ macro_rules! wrap_functions {
$(#[$meta:meta])+
fn $function:ident($($param_name:ident: $param_modifier:ident $param_type:ty),*$(,)?)
$(-> $return_type:ty)?
$block:block
$block:block;
)+
) => {
::paste::paste! {
@ -243,7 +231,7 @@ macro_rules! wrap_functions {
$(
$(#[$meta])+
fn $function($($param_name: $param_modifier $param_type),*) $(-> $return_type)?
$block
$block;
)+
}
}
@ -251,7 +239,7 @@ macro_rules! wrap_functions {
}
pub(crate) use {
apply_param_modifier, derive_clone, derive_free, nonnull_as_mut,
nonnull_as_ref, wrap_fields, wrap_fields_accessor, wrap_function,
apply_param_modifier, derive_clone, derive_free,
wrap_fields, wrap_fields_accessor, wrap_function,
wrap_functions, wrap_method, wrap_methods,
};

View file

@ -15,7 +15,7 @@ wrap_functions!(associate Packet;
fn try_load(data: val ByteSlice) -> *mut Packet {
let data = unsafe { data.as_slice() };
heap_move_ok(servicepoint::Packet::try_from(data))
}
};
/// Creates a raw [Packet] from parts.
///
@ -28,7 +28,7 @@ wrap_functions!(associate Packet;
};
heap_move_nonnull(Packet { header, payload })
}
};
);
derive_clone!(Packet);
@ -87,6 +87,5 @@ wrap_functions!(sp;
}
Err(_) => false,
}
}
};
);

View file

@ -29,9 +29,8 @@ wrap_functions!(associate UdpSocket;
let host = unsafe { CStr::from_ptr(host.as_ptr()) }
.to_str()
.expect("Bad encoding");
heap_move_ok(UdpSocket::bind_connect(host))
}
};
/// Creates a new instance of [UdpSocket].
///
@ -47,7 +46,7 @@ wrap_functions!(associate UdpSocket;
fn open_ipv4(ip1: val u8, ip2: val u8, ip3: val u8, ip4: val u8, port: val u16) -> *mut UdpSocket {
let addr = SocketAddrV4::new(Ipv4Addr::from([ip1, ip2, ip3, ip4]), port);
heap_move_ok(UdpSocket::bind_connect(addr))
}
};
);