#nalgebra #ndarray #convert #image #borrow

no-std nshare

Conversion between n-dimensional types in different Rust crates

9 breaking releases

0.10.0 Aug 29, 2024
0.9.0 Feb 3, 2022
0.8.0 Nov 12, 2021
0.7.0 Jun 26, 2021
0.1.1 Apr 4, 2020

#164 in Rust patterns

Download history 485/week @ 2024-08-23 336/week @ 2024-08-30 316/week @ 2024-09-06 422/week @ 2024-09-13 745/week @ 2024-09-20 1093/week @ 2024-09-27 1729/week @ 2024-10-04 2069/week @ 2024-10-11 1739/week @ 2024-10-18 1505/week @ 2024-10-25 1058/week @ 2024-11-01 1264/week @ 2024-11-08 866/week @ 2024-11-15 701/week @ 2024-11-22 364/week @ 2024-11-29 642/week @ 2024-12-06

2,825 downloads per month
Used in 12 crates (11 directly)

MIT license

29KB
436 lines

nshare

Discord Crates.io MIT/Apache docs.rs LoC ci

Provides traits that allow conversion between n-dimensional types in different Rust crates

NOTE: By default, this crate includes conversions for all supported crates. If you want to limit compilation, use no-default-features = true enable the corresponding feature for each dependency:

  • nalgebra
  • ndarray
  • image

When two crate features are enabled, any available conversions between the two crates are turned on.

Limitations

Right now this crate really only provides conversions to owned and borrowed ndarray types. Some limitations exist with nalgebra, as it only utilizes positive strides, while ndarray supports negative strides as well. The image crate has no concept of strides. Due to this, the ndarray crate is the most flexible, and is ideal for interoperability between these various crates.

nalgebra currently does not offer a solution to directly pass it an owned vector from ndarray, so into conversions do perform a copy. It is recommended to create the owned copy in nalgebra and then borrow a mutable array view of it using ndarray. You can then populate it accordingly without any copies of the data.

Dependencies

~5.5MB
~106K SLoC