should not have been pub use, documentation fixes

This commit is contained in:
Vinzenz Schroeter 2024-05-28 22:23:21 +02:00
parent 69d4cff0bf
commit 084c3df1db
9 changed files with 43 additions and 31 deletions

View file

@ -735,7 +735,12 @@ bool sp_connection_send(const struct sp_Connection *connection,
/**
* Deallocates a `Packet`.
*
* Note: do not call this if the instance has been consumed in another way, e.g. by sending it.
* # Safety
*
* The caller has to make sure that:
*
* - `this` points to a valid `Packet`
* - `this` is not used concurrently or after this call
*/
void sp_packet_dealloc(struct sp_Packet *this_);

View file

@ -1,5 +1,8 @@
pub use servicepoint::BitVec;
use servicepoint::DataRef;
//! C functions for interacting with `BitVec`s
//!
//! prefix `sp_bit_vec_`
use servicepoint::{BitVec, DataRef};
use crate::c_slice::CByteSlice;

View file

@ -1,5 +1,8 @@
pub use servicepoint::ByteGrid;
use servicepoint::{DataRef, Grid};
//! C functions for interacting with `ByteGrid`s
//!
//! prefix `sp_byte_grid_`
use servicepoint::{ByteGrid, DataRef, Grid};
use crate::c_slice::CByteSlice;

View file

@ -1,9 +1,13 @@
//! C functions for interacting with `Command`s
//!
//! prefix `sp_command_`
use std::ptr::null_mut;
use servicepoint::{
BitVec, ByteGrid, CompressionCode, Origin, Packet, PixelGrid,
BitVec, Brightness, ByteGrid, Command, CompressionCode, Offset, Origin,
Packet, PixelGrid,
};
pub use servicepoint::{Brightness, Command, Offset};
/// Tries to turn a `Packet` into a `Command`. The packet is deallocated in the process.
///

View file

@ -1,8 +1,11 @@
//! C functions for interacting with `Connection`s
//!
//! prefix `sp_connection_`
use std::ffi::{c_char, CStr};
use std::ptr::null_mut;
pub use servicepoint::Connection;
use servicepoint::Packet;
use servicepoint::{Connection, Packet};
/// Creates a new instance of `Connection`.
///

View file

@ -7,34 +7,16 @@ pub use servicepoint::{
pub use crate::c_slice::CByteSlice;
/// C functions for interacting with `BitVec`s
///
/// prefix `sp_bit_vec_`
pub mod bit_vec;
/// C functions for interacting with `ByteGrid`s
///
/// prefix `sp_byte_grid_`
pub mod byte_grid;
/// C functions for interacting with `Command`s
///
/// prefix `sp_command_`
pub mod command;
/// C functions for interacting with `Connection`s
///
/// prefix `sp_connection_`
pub mod connection;
/// C functions for interacting with `Packet`s
///
/// prefix `sp_packet_`
pub mod packet;
/// C functions for interacting with `PixelGrid`s
///
/// prefix `sp_pixel_grid_`
pub mod pixel_grid;
/// The minimum time needed for the display to refresh the screen in ms.

View file

@ -1,7 +1,10 @@
//! C functions for interacting with `Packet`s
//!
//! prefix `sp_packet_`
use std::ptr::null_mut;
use servicepoint::Command;
pub use servicepoint::Packet;
use servicepoint::{Command, Packet};
/// Turns a `Command` into a `Packet`.
/// The `Command` gets consumed.
@ -49,7 +52,12 @@ pub unsafe extern "C" fn sp_packet_try_load(
/// Deallocates a `Packet`.
///
/// Note: do not call this if the instance has been consumed in another way, e.g. by sending it.
/// # Safety
///
/// The caller has to make sure that:
///
/// - `this` points to a valid `Packet`
/// - `this` is not used concurrently or after this call
#[no_mangle]
pub unsafe extern "C" fn sp_packet_dealloc(this: *mut Packet) {
_ = Box::from_raw(this)

View file

@ -1,3 +1,7 @@
//! C functions for interacting with `PixelGrid`s
//!
//! prefix `sp_pixel_grid_`
use servicepoint::{DataRef, Grid, PixelGrid};
use crate::c_slice::CByteSlice;

View file

@ -220,7 +220,7 @@ namespace ServicePoint.BindGen
[DllImport(__DllName, EntryPoint = "sp_packet_try_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern Packet* sp_packet_try_load(byte* data, nuint length);
/// <summary>Deallocates a `Packet`. Note: do not call this if the instance has been consumed in another way, e.g. by sending it.</summary>
/// <summary>Deallocates a `Packet`. # Safety The caller has to make sure that: - `this` points to a valid `Packet` - `this` is not used concurrently or after this call</summary>
[DllImport(__DllName, EntryPoint = "sp_packet_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void sp_packet_dealloc(Packet* @this);