Skip to content

Commit

Permalink
Make metadata a default feature. (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmedrano authored Sep 14, 2024
1 parent 2923d0f commit 6f7f133
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt update && sudo apt install jackd2 libjack-jackd2-0 libjack-jackd2-dev
- name: Lint (No Features)
- name: Lint (Default Features)
run: cargo clippy --all-targets -- -D clippy::all
- name: Lint (metadata)
run: cargo clippy --all-targets --no-default-features --features metadata -- -D clippy::all
- name: Lint (No features)
run: cargo clippy --all-targets --no-default-features -- -D clippy::all
- name: Cargo Fmt
run: cargo fmt --check
10 changes: 6 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ jobs:
run: jackd -r -ddummy -r44100 -p1024 &
- name: Install Cargo Nextest
uses: taiki-e/install-action@nextest
- name: Build (Default Features)
run: cargo build --verbose
- name: Build (No Features)
run: cargo build --verbose --no-default-features
- name: Build (metadata)
run: cargo build --verbose --no-default-features --features metadata
- name: Build (examples)
run: cargo build --verbose --examples
- name: Run Tests
run: cargo nextest run --all-features
- name: Run Tests (Default Features)
run: cargo nextest run
- name: Run Tests (No Features)
run: cargo nextest run --no-default-features
- name: Run Doc Tests
run: cargo doc && cargo test --doc
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ crossbeam-channel = "0.5"

[features]
default = ["dynamic_loading", "log"]
dynamic_loading = ["jack-sys/dynamic_loading"]
metadata = []
dynamic_loading = ["jack-sys/dynamic_loading"]
5 changes: 0 additions & 5 deletions src/client/client_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ impl Client {
/// # Remarks
///
/// * Deallocates, not realtime safe.
#[cfg(feature = "metadata")]
pub fn uuid(&self) -> j::jack_uuid_t {
unsafe {
let mut uuid: j::jack_uuid_t = Default::default();
Expand All @@ -168,12 +167,10 @@ impl Client {
/// Get the numeric `uuid` of a client by name; returns None if client does not exist
/// # Remarks
/// * Not realtime safe
#[cfg(feature = "metadata")]
pub fn uuid_of_client_by_name(&self, name: &str) -> Option<jack_sys::jack_uuid_t> {
Self::uuid_of_client_by_name_raw(self.raw(), name)
}

#[cfg(feature = "metadata")]
pub(crate) fn uuid_of_client_by_name_raw(
raw: *mut jack_sys::jack_client_t,
name: &str,
Expand Down Expand Up @@ -224,7 +221,6 @@ impl Client {
}

/// Get the name of a client by its numeric uuid.
#[cfg(feature = "metadata")]
pub fn name_by_uuid(&self, uuid: j::jack_uuid_t) -> Option<String> {
let mut uuid_s = ['\0' as _; 37]; //jack_uuid_unparse expects an array of length 37
unsafe {
Expand Down Expand Up @@ -637,7 +633,6 @@ impl Client {
///
/// # Panics
/// Calling this method more than once on any given client with cause a panic.
#[cfg(feature = "metadata")]
pub fn register_property_change_handler<H: PropertyChangeHandler + 'static>(
&mut self,
handler: H,
Expand Down
1 change: 0 additions & 1 deletion src/client/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ fn client_uuid() {
assert_eq!(c2.name_by_uuid_str(&uuid3s), None);
}

#[cfg(feature = "metadata")]
#[test]
fn client_numeric_uuid() {
let (c1, _) = open_test_client("numeric-uuid-client1");
Expand Down
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub use crate::port::{
Unowned, PORT_NAME_SIZE, PORT_TYPE_SIZE,
};
pub use crate::primitive_types::{Frames, PortId, Time};
pub use crate::properties::*;
pub use crate::ringbuffer::{RingBuffer, RingBufferReader, RingBufferWriter};
pub use crate::transport::{
Transport, TransportBBT, TransportBBTValidationError, TransportPosition, TransportState,
Expand All @@ -56,10 +57,6 @@ pub use crate::transport::{
/// through `jack_sys::library()`.
pub use jack_sys;

//only expose metadata if enabled
#[cfg(feature = "metadata")]
pub use crate::properties::*;

mod client;
mod jack_enums;
mod jack_utils;
Expand Down
1 change: 0 additions & 1 deletion src/port/port_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ impl<PS> Port<PS> {
}
}

#[cfg(feature = "metadata")]
impl<PS> Port<PS> {
/// Returns the fully-qualified name of all ports currently connected to this one
/// Remarks: Not realtime safe
Expand Down
3 changes: 0 additions & 3 deletions src/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ pub(crate) unsafe extern "C" fn property_changed<P>(
}
}

#[cfg(feature = "metadata")]
pub use metadata::*;

#[cfg(feature = "metadata")]
mod metadata {
use super::{j, uuid, PropertyChange, PropertyChangeHandler};
use crate::Error;
Expand Down Expand Up @@ -189,7 +187,6 @@ mod metadata {
}
}

#[cfg(feature = "metadata")]
impl Client {
/// Get a property from a subject.
///
Expand Down

0 comments on commit 6f7f133

Please sign in to comment.