Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure braids implement StructuralEq and StructuralPartialEq #8

Closed
neoeinstein opened this issue Jul 10, 2021 · 2 comments
Closed

Ensure braids implement StructuralEq and StructuralPartialEq #8

neoeinstein opened this issue Jul 10, 2021 · 2 comments

Comments

@neoeinstein
Copy link
Owner

This will allow for using const values in pattern matching when that lands, as in the following:

#[braid]
struct MyData;

const TEST_VAL: &MyDataRef = MyDataRef::from_str("test");

match some_data_ref {
    TEST_VAL => println!("test!"),
    _ => println!("not a test…"),
}
@neoeinstein
Copy link
Owner Author

Still working toward this. Even with const values, the compiler doesn't like this custom type as the pattern to assert on:

cannot use unsized non-slice type `Type` in constant patterns

See rust-lang/rust#87046

@neoeinstein
Copy link
Owner Author

This is closed via #13, but the compiler still prevents this as mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant