Skip to content

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
simsekgokhan committed Jan 5, 2024
1 parent 16164ba commit b3a583a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/traits_associated_constants.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// https://doc.rust-lang.org/reference/items/associated-items.html#associated-constants

trait MyTrait {
const MY_CONST: u8; // Associated Constant
const MY_CONST: u8; // Associated Constant
const CONST_WITH_DEFAULT: i32 = 99; // Associated Constant w/ default value
fn bar();
}

Expand All @@ -15,4 +16,5 @@ impl MyTrait for Foo {
#[test]
fn ex1() {
assert_eq!(Foo::MY_CONST, 42);
assert_eq!(Foo::CONST_WITH_DEFAULT, 99);
}

0 comments on commit b3a583a

Please sign in to comment.