features, cargo fmt

This commit is contained in:
Vinzenz Schroeter 2025-04-12 22:32:27 +02:00
parent 3589a90385
commit 3a966ad1a1
9 changed files with 25 additions and 15 deletions

View file

@ -26,8 +26,9 @@ git = "https://git.berlin.ccc.de/servicepoint/servicepoint/"
branch = "next" branch = "next"
[features] [features]
full = ["servicepoint/all_compressions", "servicepoint/default"] protocol_udp = ["servicepoint/protocol_udp"]
default = ["full"] all_compressions = ["servicepoint/all_compressions"]
default = ["all_compressions", "servicepoint/default", "protocol_udp"]
[lints.rust] [lints.rust]
missing-docs = "warn" missing-docs = "warn"

View file

@ -3,6 +3,7 @@ CARGO := rustup run nightly cargo
TARGET := x86_64-unknown-linux-musl TARGET := x86_64-unknown-linux-musl
PROFILE := size-optimized PROFILE := size-optimized
FEATURES := protocol_udp
THIS_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) THIS_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(THIS_DIR)/.. REPO_ROOT := $(THIS_DIR)/..
@ -22,6 +23,7 @@ RUSTFLAGS := -Zlocation-detail=none \
CARGOFLAGS := --manifest-path=$(REPO_ROOT)/Cargo.toml \ CARGOFLAGS := --manifest-path=$(REPO_ROOT)/Cargo.toml \
--profile=$(PROFILE) \ --profile=$(PROFILE) \
--no-default-features \ --no-default-features \
--features=$(FEATURES) \
--target=$(TARGET) \ --target=$(TARGET) \
-Zbuild-std="core,std,alloc,proc_macro,panic_abort" \ -Zbuild-std="core,std,alloc,proc_macro,panic_abort" \
-Zbuild-std-features="panic_immediate_abort" \ -Zbuild-std-features="panic_immediate_abort" \
@ -53,7 +55,7 @@ _programs := $(basename $(_c_src))
_bins := $(addprefix out/, $(_programs)) _bins := $(addprefix out/, $(_programs))
_unstripped_bins := $(addsuffix _unstripped, $(_bins)) _unstripped_bins := $(addsuffix _unstripped, $(_bins))
_run_programs := $(addprefix run_, $(_programs)) _run_programs := $(addprefix run_, $(_programs))
_rs_src := $(wildcard ../src/**.rs) ../Cargo.lock _rs_src := $(wildcard ../src/**.rs) ../Cargo.lock ../Cargo.toml ../cbindgen.toml
all: $(_bins) all: $(_bins)

View file

@ -1,6 +1,8 @@
use crate::byte_slice::ByteSlice; use crate::byte_slice::ByteSlice;
use crate::{heap_drop, heap_move, heap_move_nonnull, heap_remove, SPBitVec}; use crate::{heap_drop, heap_move, heap_move_nonnull, heap_remove, SPBitVec};
use servicepoint::{Bitmap, BitmapCommand, CompressionCode, DataRef, Grid, Origin, Packet}; use servicepoint::{
Bitmap, BitmapCommand, CompressionCode, DataRef, Grid, Origin, Packet,
};
use std::ptr::NonNull; use std::ptr::NonNull;
/// Creates a new [Bitmap] with the specified dimensions. /// Creates a new [Bitmap] with the specified dimensions.
@ -210,7 +212,7 @@ pub unsafe extern "C" fn sp_bitmap_into_packet(
bitmap: NonNull<Bitmap>, bitmap: NonNull<Bitmap>,
x: usize, x: usize,
y: usize, y: usize,
compression: CompressionCode compression: CompressionCode,
) -> *mut Packet { ) -> *mut Packet {
let bitmap = unsafe { heap_remove(bitmap) }; let bitmap = unsafe { heap_remove(bitmap) };
match Packet::try_from(BitmapCommand { match Packet::try_from(BitmapCommand {

View file

@ -1,5 +1,7 @@
use crate::{heap_drop, heap_move, heap_move_nonnull, heap_remove, ByteSlice}; use crate::{heap_drop, heap_move, heap_move_nonnull, heap_remove, ByteSlice};
use servicepoint::{BinaryOperation, BitVecCommand, BitVecU8Msb0, CompressionCode, Packet}; use servicepoint::{
BinaryOperation, BitVecCommand, BitVecU8Msb0, CompressionCode, Packet,
};
use std::ptr::NonNull; use std::ptr::NonNull;
/// A vector of bits /// A vector of bits
@ -157,7 +159,7 @@ pub unsafe extern "C" fn sp_bitvec_into_packet(
bitvec: NonNull<SPBitVec>, bitvec: NonNull<SPBitVec>,
offset: usize, offset: usize,
operation: BinaryOperation, operation: BinaryOperation,
compression: CompressionCode compression: CompressionCode,
) -> *mut Packet { ) -> *mut Packet {
let bitvec = unsafe { heap_remove(bitvec) }.0; let bitvec = unsafe { heap_remove(bitvec) }.0;
match Packet::try_from(BitVecCommand { match Packet::try_from(BitVecCommand {

View file

@ -1,3 +0,0 @@
mod typed;
pub use typed::*;

View file

@ -1,5 +1,7 @@
use crate::{heap_drop, heap_move, heap_move_nonnull, heap_remove, ByteSlice}; use crate::{heap_drop, heap_move, heap_move_nonnull, heap_remove, ByteSlice};
use servicepoint::{Cp437Grid, Cp437GridCommand, DataRef, Grid, Origin, Packet}; use servicepoint::{
Cp437Grid, Cp437GridCommand, DataRef, Grid, Origin, Packet,
};
use std::ptr::NonNull; use std::ptr::NonNull;
/// Creates a new [Cp437Grid] with the specified dimensions. /// Creates a new [Cp437Grid] with the specified dimensions.

View file

@ -30,22 +30,26 @@ pub use crate::bitvec::*;
pub use crate::brightness_grid::*; pub use crate::brightness_grid::*;
pub use crate::byte_slice::*; pub use crate::byte_slice::*;
pub use crate::char_grid::*; pub use crate::char_grid::*;
pub use crate::commands::*;
pub use crate::connection::*;
pub use crate::cp437_grid::*; pub use crate::cp437_grid::*;
pub use crate::packet::*; pub use crate::packet::*;
pub use servicepoint::CommandCode; pub use servicepoint::CommandCode;
use std::ptr::NonNull; use std::ptr::NonNull;
pub use typed_command::*;
mod bitmap; mod bitmap;
mod bitvec; mod bitvec;
mod brightness_grid; mod brightness_grid;
mod byte_slice; mod byte_slice;
mod char_grid; mod char_grid;
mod commands;
mod connection;
mod cp437_grid; mod cp437_grid;
mod packet; mod packet;
mod typed_command;
#[cfg(feature = "protocol_udp")]
mod udp;
#[cfg(feature = "protocol_udp")]
pub use udp::*;
use std::time::Duration; use std::time::Duration;