servicepoint_binding_c 0.15.0

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

wrap!(
    Cp437GridCommand {
    derives: crate::commands::derive_command[Cp437Grid], crate::commands::derive_origin_accessors;
    properties:
        prop grid: Cp437Grid { get mut; set move; };
    functions:
        /// Show text on the screen.
        ///
        /// The text is sent in the form of a 2D grid of [CP-437] encoded characters.
        ///
        /// The origin is relative to the top-left of the display.
        fn new(
            grid: move NonNull<Cp437Grid>,
            origin_x: val usize,
            origin_y: val usize,
        ) -> move NonNull<Cp437GridCommand> {
            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>) -> move NonNull<Cp437GridCommand> {
            grid.into()
        };
    }
);