all: split reusable components into workspace crates
This commit is contained in:
parent
2a079ed800
commit
657e7ce2f7
225 changed files with 7422 additions and 17602 deletions
|
|
@ -370,6 +370,7 @@ macro_rules! dedicated_add_global {
|
|||
};
|
||||
}
|
||||
|
||||
#[expect(unused_macros)]
|
||||
macro_rules! assert_size_eq {
|
||||
($t:ty, $u:ty) => {{
|
||||
struct AssertEqSize<T, U>(std::marker::PhantomData<T>, std::marker::PhantomData<U>);
|
||||
|
|
@ -401,6 +402,7 @@ macro_rules! assert_size_le {
|
|||
}};
|
||||
}
|
||||
|
||||
#[expect(unused_macros)]
|
||||
macro_rules! assert_align_eq {
|
||||
($t:ty, $u:ty) => {{
|
||||
struct AssertEqAlign<T, U>(std::marker::PhantomData<T>, std::marker::PhantomData<U>);
|
||||
|
|
@ -632,86 +634,6 @@ macro_rules! bitflags {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! pw_opcodes {
|
||||
($name:ident; $($var:ident = $val:expr,)*) => {
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum $name {
|
||||
$(
|
||||
$var,
|
||||
)*
|
||||
}
|
||||
|
||||
#[allow(clippy::allow_attributes, dead_code)]
|
||||
impl $name {
|
||||
pub fn from_id(id: u8) -> Option<Self> {
|
||||
let v = match id {
|
||||
$($val => Self::$var,)*
|
||||
_ => return None,
|
||||
};
|
||||
Some(v)
|
||||
}
|
||||
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
$(Self::$var => stringify!($var),)*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::pipewire::pw_object::PwOpcode for $name {
|
||||
fn id(&self) -> u8 {
|
||||
match self {
|
||||
$(Self::$var => $val,)*
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! pw_object_base {
|
||||
($name:ident, $if:expr, $events:ident; $($event:ident => $method:ident,)*) => {
|
||||
impl crate::pipewire::pw_object::PwObjectBase for $name {
|
||||
fn data(&self) -> &crate::pipewire::pw_object::PwObjectData {
|
||||
&self.data
|
||||
}
|
||||
|
||||
fn interface(&self) -> &str {
|
||||
$if
|
||||
}
|
||||
|
||||
fn handle_msg(self: std::rc::Rc<Self>, opcode: u8, parser: crate::pipewire::pw_parser::PwParser<'_>) -> Result<(), crate::pipewire::pw_object::PwObjectError> {
|
||||
match $events::from_id(opcode) {
|
||||
None => Err(crate::pipewire::pw_object::PwObjectError {
|
||||
interface: $if,
|
||||
source: crate::pipewire::pw_object::PwObjectErrorType::UnknownEvent(opcode),
|
||||
}),
|
||||
Some(m) => {
|
||||
let (res, method) = match m {
|
||||
$(
|
||||
$events::$event => (self.$method(parser), stringify!($event)),
|
||||
)*
|
||||
};
|
||||
match res {
|
||||
Ok(_) => Ok(()),
|
||||
Err(source) => Err(crate::pipewire::pw_object::PwObjectError {
|
||||
interface: $if,
|
||||
source: crate::pipewire::pw_object::PwObjectErrorType::EventError {
|
||||
method,
|
||||
source: Box::new(source),
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn event_name(&self, opcode: u8) -> Option<&'static str> {
|
||||
$events::from_id(opcode).map(|o| o.name())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! ei_id {
|
||||
($name:ident) => {
|
||||
#[derive(Debug, Copy, Clone, Hash, Ord, PartialOrd, Eq, PartialEq)]
|
||||
|
|
@ -829,12 +751,6 @@ macro_rules! not_matches {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! jay_allow_realtime_config_so {
|
||||
() => {
|
||||
"JAY_ALLOW_REALTIME_CONFIG_SO"
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(clippy::allow_attributes, unused_macros)]
|
||||
macro_rules! dbg {
|
||||
($val:expr) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue