improve doc comments

This commit is contained in:
Vinzenz Schroeter 2024-08-29 22:02:53 +02:00
parent e0d5eff494
commit c9c51dcdc2
3 changed files with 13 additions and 36 deletions

View file

@ -128,7 +128,7 @@ typedef uint16_t sp_CompressionCode;
typedef struct sp_Brightness sp_Brightness;
/**
* Opaque struct needed for correct code generation.
* A vector of bits
*/
typedef struct sp_CBitVec sp_CBitVec;
@ -138,7 +138,11 @@ typedef struct sp_CBitVec sp_CBitVec;
typedef struct sp_CBrightnessGrid sp_CBrightnessGrid;
/**
* Opaque struct needed for correct code generation.
* A low-level display command.
*
* This struct and associated functions implement the UDP protocol for the display.
*
* To send a `CCommand`, use a `Connection`.
*/
typedef struct sp_CCommand sp_CCommand;
@ -149,37 +153,6 @@ typedef struct sp_CCommand sp_CCommand;
*/
typedef struct sp_CCp437Grid sp_CCp437Grid;
/**
* A low-level display command.
*
* This struct and associated functions implement the UDP protocol for the display.
*
* To send a `Command`, use a `Connection`.
*
* # Examples
*
* ```rust
* # use servicepoint::{Brightness, Command, Connection, Packet};
*
* // create command
* let command = Command::Brightness(Brightness::MAX);
*
* // turn command into Packet
* let packet: Packet = command.clone().into();
*
* // read command from packet
* let round_tripped = Command::try_from(packet).unwrap();
*
* // round tripping produces exact copy
* assert_eq!(command, round_tripped);
*
* // send command
* # let connection = Connection::open("127.0.0.1:2342").unwrap();
* connection.send(command).unwrap();
* ```
*/
typedef struct sp_Command sp_Command;
/**
* A connection to the display.
*
@ -1046,7 +1019,7 @@ void sp_packet_dealloc(struct sp_Packet *this_);
* - the returned `Packet` instance is freed in some way, either by using a consuming function or
* by explicitly calling `sp_packet_dealloc`.
*/
struct sp_Packet *sp_packet_from_command(struct sp_Command *command);
struct sp_Packet *sp_packet_from_command(struct sp_CCommand *command);
/**
* Tries to load a `Packet` from the passed array with the specified length.

View file

@ -8,7 +8,7 @@ use servicepoint::bitvec::prelude::{BitVec, Msb0};
/// cbindgen:no-export
type SpBitVec = BitVec<u8, Msb0>;
/// Opaque struct needed for correct code generation.
/// A vector of bits
#[derive(Clone)]
pub struct CBitVec {
actual: SpBitVec,

View file

@ -12,7 +12,11 @@ use crate::bit_vec::CBitVec;
use crate::brightness_grid::CBrightnessGrid;
use crate::cp437_grid::CCp437Grid;
/// Opaque struct needed for correct code generation.
/// A low-level display command.
///
/// This struct and associated functions implement the UDP protocol for the display.
///
/// To send a `CCommand`, use a `Connection`.
pub struct CCommand(pub(crate) Command);
impl Clone for CCommand {