collect crates/ and deps/

This commit is contained in:
🪞👃🪞 2025-04-19 01:23:43 +03:00
parent 2f8882f6cd
commit 8fa0f8a409
140 changed files with 23 additions and 21 deletions

57
crates/time/src/lib.rs Normal file
View file

@ -0,0 +1,57 @@
mod clock; pub use self::clock::*;
mod microsecond; pub use self::microsecond::*;
mod moment; pub use self::moment::*;
mod note_duration; pub use self::note_duration::*;
mod perf; pub use self::perf::*;
mod pulse; pub use self::pulse::*;
mod sample_count; pub use self::sample_count::*;
mod sample_rate; pub use self::sample_rate::*;
mod timebase; pub use self::timebase::*;
mod unit; pub use self::unit::*;
pub(crate) use ::tek_jack::{*, jack::{*, contrib::*}};
pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicBool, AtomicUsize, Ordering::*}};
pub(crate) use std::ops::{Add, Sub, Mul, Div, Rem};
pub(crate) use ::tengri::{input::*, dsl::*};
pub use ::atomic_float; pub(crate) use atomic_float::*;
/// Standard result type.
pub(crate) type Usually<T> = Result<T, Box<dyn std::error::Error>>;
/// Standard optional result type.
pub(crate) type Perhaps<T> = Result<Option<T>, Box<dyn std::error::Error>>;
pub trait Gettable<T> {
/// Returns current value
fn get (&self) -> T;
}
pub trait Mutable<T>: Gettable<T> {
/// Sets new value, returns old
fn set (&mut self, value: T) -> T;
}
pub trait InteriorMutable<T>: Gettable<T> {
/// Sets new value, returns old
fn set (&self, value: T) -> T;
}
impl Gettable<bool> for AtomicBool {
fn get (&self) -> bool { self.load(Relaxed) }
}
impl InteriorMutable<bool> for AtomicBool {
fn set (&self, value: bool) -> bool { self.swap(value, Relaxed) }
}
impl Gettable<usize> for AtomicUsize {
fn get (&self) -> usize { self.load(Relaxed) }
}
impl InteriorMutable<usize> for AtomicUsize {
fn set (&self, value: usize) -> usize { self.swap(value, Relaxed) }
}
#[cfg(test)] #[test] fn test_time () -> Usually<()> {
// TODO!
Ok(())
}