Skip to content

Add support for partialeq & debug to dim4 #64

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

Merged
merged 1 commit into from
Apr 4, 2016
Merged

Conversation

jramapuram
Copy link
Member

Very annoying doing:

if arr.dims().unwrap().get().clone() == arr2.dims().unwrap().get().clone() {}

Also debug offers:

println!("dims = {:?}", arr.dims().unwrap());

Very annoying doing:
```rust
if arr.dims().unwrap().get().clone() == arr2.dims().unwrap().get().clone() {}
```
@pavanky
Copy link
Member

pavanky commented Mar 30, 2016

@jramapuram just curious. How would the API look when comparing dims now?

@jramapuram
Copy link
Member Author

@pavanky : It looks like the example I provided. You need to do a .unwrap.get() to get the base [u64; 4] fixed array. Rust can natively compare one fixed [u64; 4] array to another by using PartialEq which can be automatically derived.

Question for you: is there every a case when accessing .dims() of an af::array that it can return an error code? I.e. do we need the unwrap even?

@9prady9 9prady9 merged commit e666fd6 into devel Apr 4, 2016
@9prady9 9prady9 deleted the hotfix/derives branch April 4, 2016 08:31
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

Successfully merging this pull request may close these issues.

3 participants