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"
[features]
full = ["servicepoint/all_compressions", "servicepoint/default"]
default = ["full"]
protocol_udp = ["servicepoint/protocol_udp"]
all_compressions = ["servicepoint/all_compressions"]
default = ["all_compressions", "servicepoint/default", "protocol_udp"]
[lints.rust]
missing-docs = "warn"

View file

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

View file

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

View file

@ -1,5 +1,7 @@
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;
/// A vector of bits
@ -157,7 +159,7 @@ pub unsafe extern "C" fn sp_bitvec_into_packet(
bitvec: NonNull<SPBitVec>,
offset: usize,
operation: BinaryOperation,
compression: CompressionCode
compression: CompressionCode,
) -> *mut Packet {
let bitvec = unsafe { heap_remove(bitvec) }.0;
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 servicepoint::{Cp437Grid, Cp437GridCommand, DataRef, Grid, Origin, Packet};
use servicepoint::{
Cp437Grid, Cp437GridCommand, DataRef, Grid, Origin, Packet,
};
use std::ptr::NonNull;
/// 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::byte_slice::*;
pub use crate::char_grid::*;
pub use crate::commands::*;
pub use crate::connection::*;
pub use crate::cp437_grid::*;
pub use crate::packet::*;
pub use servicepoint::CommandCode;
use std::ptr::NonNull;
pub use typed_command::*;
mod bitmap;
mod bitvec;
mod brightness_grid;
mod byte_slice;
mod char_grid;
mod commands;
mod connection;
mod cp437_grid;
mod packet;
mod typed_command;
#[cfg(feature = "protocol_udp")]
mod udp;
#[cfg(feature = "protocol_udp")]
pub use udp::*;
use std::time::Duration;