2 unstable releases
new 0.2.2 | Feb 11, 2025 |
---|---|
0.2.1 |
|
0.2.0 |
|
0.1.0 | Feb 10, 2025 |
#602 in Rust patterns
286 downloads per month
11KB
177 lines
symbol-ty
A simple crate that allows to create a type that represents a unique symbol.
Usage
Add this to your Cargo.toml
:
[dependencies]
symbol-ty = "0.2"
Example
use symbol_ty::Symbol;
fn main() {
let symbol1 = <Symbol!("foo")>::new();
let symbol2 = <Symbol!("foo")>::new();
assert_eq!(symbol1, symbol2);
println!("{}", symbol1);
println!("{:?}", symbol1);
}
struct Foo {
foo: Symbol!("foo"),
}
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~1.3–2MB
~39K SLoC