dfrankland / bitrate Goto Github PK
View Code? Open in Web Editor NEWExtension traits that add convenience methods for working with bitrates and frequencies.
Home Page: https://docs.rs/bitrate/0.1.1/bitrate/
License: MIT License
Extension traits that add convenience methods for working with bitrates and frequencies.
Home Page: https://docs.rs/bitrate/0.1.1/bitrate/
License: MIT License
I've found many strange things about this lib:
PartialEq
, Eq
, PartialOrd
, Ord
Self
:
pub trait $TXExt {
/// Wrap in `Bps`
fn bps(self) -> Bps<Self>;
pub trait Ext {
/// Wrap in `Bps`
fn bps(self) -> Bps<Self> { Bps(self) }
// ...
}
impl Ext for u8 {}
// ...
impl Ext for u128 {}
Bps
, Hertz
, ...) should at least implement Add<Output = Self>
, Sub<Output = Self>
, Mul<Rhs = T, Output = Self>
, Div<Rhs = T, Output = Self>
Into
is implemented for structs, instead of From
. From docs:
One should always prefer implementing From over Into because implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.
Into
/From
could be implemented without macro (but this requires some more thinking and maybe adding dependency like num
)TryFrom
so users will be able to handle overflowsinto_inner :: self -> T
). This will likely prevent users from writing such code:
(x.0 * 10).hz();
// instead of
x * 10;
map :: self -> (impl FnOnce(T) -> T) -> T
so it would be easier to work with these structs)If you don't mind, I would like to fix this in a PRs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.