wip fix documentation
This commit is contained in:
parent
597614bc95
commit
e0d82b2b87
13 changed files with 405 additions and 380 deletions
|
|
@ -1,4 +1,4 @@
|
|||
//! C functions for interacting with [SPCp437Grid]s
|
||||
//! C functions for interacting with [Cp437Grid]s
|
||||
//!
|
||||
//! prefix `sp_cp437_grid_`
|
||||
//!
|
||||
|
|
@ -20,9 +20,9 @@ use crate::SPByteSlice;
|
|||
use servicepoint::{Cp437Grid, DataRef, Grid};
|
||||
use std::ptr::NonNull;
|
||||
|
||||
/// Creates a new [SPCp437Grid] with the specified dimensions.
|
||||
/// Creates a new [Cp437Grid] with the specified dimensions.
|
||||
///
|
||||
/// returns: [SPCp437Grid] initialized to 0. Will never return NULL.
|
||||
/// returns: [Cp437Grid] initialized to 0. Will never return NULL.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
|
|
@ -39,7 +39,7 @@ pub unsafe extern "C" fn sp_cp437_grid_new(
|
|||
NonNull::from(Box::leak(result))
|
||||
}
|
||||
|
||||
/// Loads a [SPCp437Grid] with the specified dimensions from the provided data.
|
||||
/// Loads a [Cp437Grid] with the specified dimensions from the provided data.
|
||||
///
|
||||
/// Will never return NULL.
|
||||
///
|
||||
|
|
@ -71,7 +71,7 @@ pub unsafe extern "C" fn sp_cp437_grid_load(
|
|||
}
|
||||
}
|
||||
|
||||
/// Clones a [SPCp437Grid].
|
||||
/// Clones a [Cp437Grid].
|
||||
///
|
||||
/// Will never return NULL.
|
||||
///
|
||||
|
|
@ -83,7 +83,7 @@ pub unsafe extern "C" fn sp_cp437_grid_load(
|
|||
///
|
||||
/// The caller has to make sure that:
|
||||
///
|
||||
/// - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
/// - `cp437_grid` points to a valid [Cp437Grid]
|
||||
/// - `cp437_grid` is not written to concurrently
|
||||
/// - the returned instance is freed in some way, either by using a consuming function or
|
||||
/// by explicitly calling `sp_cp437_grid_free`.
|
||||
|
|
@ -95,7 +95,7 @@ pub unsafe extern "C" fn sp_cp437_grid_clone(
|
|||
NonNull::from(Box::leak(result))
|
||||
}
|
||||
|
||||
/// Deallocates a [SPCp437Grid].
|
||||
/// Deallocates a [Cp437Grid].
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
|
|
@ -105,11 +105,11 @@ pub unsafe extern "C" fn sp_cp437_grid_clone(
|
|||
///
|
||||
/// The caller has to make sure that:
|
||||
///
|
||||
/// - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
/// - `cp437_grid` points to a valid [Cp437Grid]
|
||||
/// - `cp437_grid` is not used concurrently or after cp437_grid call
|
||||
/// - `cp437_grid` was not passed to another consuming function, e.g. to create a [SPCommand]
|
||||
/// - `cp437_grid` was not passed to another consuming function, e.g. to create a [TypedCommand]
|
||||
///
|
||||
/// [SPCommand]: [crate::SPCommand]
|
||||
/// [TypedCommand]: [crate::TypedCommand]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sp_cp437_grid_free(cp437_grid: NonNull<Cp437Grid>) {
|
||||
_ = unsafe { Box::from_raw(cp437_grid.as_ptr()) };
|
||||
|
|
@ -131,7 +131,7 @@ pub unsafe extern "C" fn sp_cp437_grid_free(cp437_grid: NonNull<Cp437Grid>) {
|
|||
///
|
||||
/// The caller has to make sure that:
|
||||
///
|
||||
/// - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
/// - `cp437_grid` points to a valid [Cp437Grid]
|
||||
/// - `cp437_grid` is not written to concurrently
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sp_cp437_grid_get(
|
||||
|
|
@ -142,7 +142,7 @@ pub unsafe extern "C" fn sp_cp437_grid_get(
|
|||
unsafe { cp437_grid.as_ref().get(x, y) }
|
||||
}
|
||||
|
||||
/// Sets the value of the specified position in the [SPCp437Grid].
|
||||
/// Sets the value of the specified position in the [Cp437Grid].
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
|
|
@ -175,7 +175,7 @@ pub unsafe extern "C" fn sp_cp437_grid_set(
|
|||
unsafe { (*cp437_grid.as_ptr()).set(x, y, value) };
|
||||
}
|
||||
|
||||
/// Sets the value of all cells in the [SPCp437Grid].
|
||||
/// Sets the value of all cells in the [Cp437Grid].
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
|
|
@ -190,7 +190,7 @@ pub unsafe extern "C" fn sp_cp437_grid_set(
|
|||
///
|
||||
/// The caller has to make sure that:
|
||||
///
|
||||
/// - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
/// - `cp437_grid` points to a valid [Cp437Grid]
|
||||
/// - `cp437_grid` is not written to or read from concurrently
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sp_cp437_grid_fill(
|
||||
|
|
@ -200,7 +200,7 @@ pub unsafe extern "C" fn sp_cp437_grid_fill(
|
|||
unsafe { (*cp437_grid.as_ptr()).fill(value) };
|
||||
}
|
||||
|
||||
/// Gets the width of the [SPCp437Grid] instance.
|
||||
/// Gets the width of the [Cp437Grid] instance.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
|
|
@ -214,7 +214,7 @@ pub unsafe extern "C" fn sp_cp437_grid_fill(
|
|||
///
|
||||
/// The caller has to make sure that:
|
||||
///
|
||||
/// - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
/// - `cp437_grid` points to a valid [Cp437Grid]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sp_cp437_grid_width(
|
||||
cp437_grid: NonNull<Cp437Grid>,
|
||||
|
|
@ -222,7 +222,7 @@ pub unsafe extern "C" fn sp_cp437_grid_width(
|
|||
unsafe { cp437_grid.as_ref().width() }
|
||||
}
|
||||
|
||||
/// Gets the height of the [SPCp437Grid] instance.
|
||||
/// Gets the height of the [Cp437Grid] instance.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
|
|
@ -236,7 +236,7 @@ pub unsafe extern "C" fn sp_cp437_grid_width(
|
|||
///
|
||||
/// The caller has to make sure that:
|
||||
///
|
||||
/// - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
/// - `cp437_grid` points to a valid [Cp437Grid]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sp_cp437_grid_height(
|
||||
cp437_grid: NonNull<Cp437Grid>,
|
||||
|
|
@ -244,7 +244,7 @@ pub unsafe extern "C" fn sp_cp437_grid_height(
|
|||
unsafe { cp437_grid.as_ref().height() }
|
||||
}
|
||||
|
||||
/// Gets an unsafe reference to the data of the [SPCp437Grid] instance.
|
||||
/// Gets an unsafe reference to the data of the [Cp437Grid] instance.
|
||||
///
|
||||
/// Will never return NULL.
|
||||
///
|
||||
|
|
@ -256,9 +256,9 @@ pub unsafe extern "C" fn sp_cp437_grid_height(
|
|||
///
|
||||
/// The caller has to make sure that:
|
||||
///
|
||||
/// - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
/// - the returned memory range is never accessed after the passed [SPCp437Grid] has been freed
|
||||
/// - the returned memory range is never accessed concurrently, either via the [SPCp437Grid] or directly
|
||||
/// - `cp437_grid` points to a valid [Cp437Grid]
|
||||
/// - the returned memory range is never accessed after the passed [Cp437Grid] has been freed
|
||||
/// - the returned memory range is never accessed concurrently, either via the [Cp437Grid] or directly
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sp_cp437_grid_unsafe_data_ref(
|
||||
cp437_grid: NonNull<Cp437Grid>,
|
||||
|
|
|
|||
Loading…
Reference in a new issue