servicepoint_binding_c 0.15.0

C bindings for the servicepoint crate.
Documentation
use crate::macros::wrap;
use servicepoint::{CharGrid, CharGridCommand, Origin};
use std::ptr::NonNull;

wrap!(
    CharGridCommand {
    derives: crate::commands::derive_command[CharGrid], crate::commands::derive_origin_accessors;
    properties:
        prop grid: CharGrid { get mut; set move; };
    functions:
        /// Show UTF-8 encoded text on the screen.
        ///
        /// The passed [CharGrid] gets consumed.
        ///
        /// Returns: a new [CharGridCommand] instance.
        fn new(
            grid: move NonNull<CharGrid>,
            origin_x: val usize,
            origin_y: val usize,
        ) -> move NonNull<CharGridCommand> {
            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>) -> move NonNull<CharGridCommand> {
            grid.into()
        };
    }
);